Search code examples
imapmailkit

Mailkit: Is there a way to test whether a folder is Special Folder?


I am reading all the IMAP folders by recursively going through all the folders. In my UI, I would like to designate the Special Folders so that they show up at the top.

Is there any property or method already available that can tell me if any folder is a special folder and what is the enumeration type? Or, do I have to check the folder name to determine this.

PS: I think if the server supports XLIST or Special-Use you can get a special folder using the GetFolder call, but I could not find anything that will test if an IMailFolder is a Special Folder.


Solution

  • You can check the folder's Attributes property to see if it contains any of the special folder attributes (FolerAttributes.All, Archive, Drafts, Flagged, Inbox, Junk, Sent, Trash).