Search code examples
outlookvstooutlook-addinoffice-interopoffice-addins

VSTO Outlook: How to get the list of default folders that are shown by default in Outlook


From an Outlook VSTO Add-in, how can I know the list of folders shown by default in the Outlook? I mean, Inbox, Outbox, Sent Items, Deleted Items, etc. The ones that Outlook shows by default and make available to the user.


Solution

  • Assuming you mean mail folders. Outlook shows all mail folders (Mail.DefaultItemType == OlItemType.olMailItem) that are not hidden - PR_ATTR_HIDDEN MAPI property must be missing or false (use MAPIFolder.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x10F4000B")).

    Now the order of the folders is a different matter...