3

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.

Samuel
  • 1,949
  • 4
  • 18
  • 30

1 Answers1

3

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).

jstedfast
  • 35,744
  • 5
  • 97
  • 110
  • Thanks, I think I looked at it before but missed it. So, if the Special-Use or XLIST is not supported, then also it will heuristically set the correct attributes or I need to do that myself? – Samuel Apr 13 '19 at 16:46
  • 1
    It will set Inbox (because that one always has the same name), but it will not set the others. You shouldn't set those values, though, just use your own logic on top of that. – jstedfast Apr 13 '19 at 16:48