Archived Forum Post

Index of archived forum posts

Question:

Identify the type of the mailbox received CkoMailboxes listMailboxes

Jul 20 '14 at 18:50

Hi,

I am fetching the mailboxes using :

  CkoMailboxes *mailBoxes = [[CkoMailboxes alloc]init];
  mailBoxes = [imap ListMailboxes:@"" wildcardedMailbox:@"*"];

Is there any way to identify the mailbox type.

For eg: Inbox folder should not get deleted. Thus while checkin that, when i try to delete INBOX folder, i get the following error log.

ChilkatLog: DeleteMailbox:

Failed to delete mailbox...
imapDeleteResponse: aaaj NO [CANNOT] Internal folder cannot be deleted. (Failure)
Failed.

--DeleteMailbox

--ChilkatLog

This log mentions INBOX is an Internal folder.

So, are there any more types which we can get with mailbox to differentiate between Primary mailboxes like: Inbox, Drafts, Sent, Trash and other custom folders. Accordingly we have to reflect on UI when user wants to edit mailboxes.

Thanks.


Answer

See the API for the Mailboxes class: http://www.chilkatsoft.com/refdoc/csMailboxesRef.html

Examine the flags of each mailbox...


Answer

Hi.. thanks for your response. But its still unclear to me. I checked the GetFlags method on the CKoMailboxes received. And for a gmail account i am receiving following flags:

INBOX: HasNoChildren

*Madhura123: HasChildren Madhura123/Madhura1234: HasNoChildren*

Notes: HasNoChildren

Personal: HasNoChildren

Receipts: HasNoChildren

Travel: HasNoChildren

[Gmail]/All Mail: HasNoChildren,All

[Gmail]/Drafts: HasNoChildren,Drafts

[Gmail]/Important: HasNoChildren,Important

[Gmail]/Sent Mail: HasNoChildren,Sent

[Gmail]/Spam: HasNoChildren,Junk

[Gmail]/Starred: HasNoChildren,Flagged

[Gmail]/Trash: HasNoChildren,Trash

From this log its still not clear, which are the primary folders and which are custom made by the user. Like for eg: Madhura123: HasChildren

Madhura123/Madhura1234: HasNoChildren only specifies whether the mailbox contains any subfolders or not.

So is there any way to get the type of the folder.

Thanks again in advance for any help.. !