none
How can i detect an outlook mail folder if it's hidden? RRS feed

  • Question

  • I have a list box, and i want to list email folders inside it. I create the data source like:

    Outlook.Folders folders = ThisAddIn.app.ActiveExplorer().Session.Folders["my email address"].Folders;
    List<Outlook.Folder> folderSource = new List<Outlook.Folder>();
    foreach (Outlook.Folder folder in folders)
    {
    if (folder.DefaultItemType == Outlook.OlItemType.olMailItem)
    	{
    		folderSource.Add(folder);
    	}
    }

    But, it contains some other hidden folders such as "Sync Issues" etc. How can i filter those folders ? I tried to use folder.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x10F4000B")), however it gives error "The property "http://schemas.microsoft.com/mapi/proptag/0x10F4000B" is unknown or cannot be found."


    Tuesday, November 19, 2013 4:37 PM

Answers

  • "Sync Issues" folder is not hidden.

    If PR_ATTR_HIDDEN is not present, you should handle the exception and assume PR_ATTR_HIDDEN = false


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Tuesday, November 19, 2013 4:48 PM