PR_ATTR_HIDDEN attribute inconsistency RRS feed

  • Question

  • I've seen a couple of posts that cover part of the problem, but not quite identical to mine.  Hopefully I didn't miss the one that might have answered it, but here goes...

    C#, VSTO, Outlook 2016 - O365

    I'm enumerating folders in Outlook message stores and attempting to skip hidden ones.  As has been mentioned in other posts, the PR_ATTR_HIDDEN attribute does not always exist and should be considered false (not hidden) when it is missing (exception thrown for missing attribute).  My problem lies in the fact that some of the folders which appear to be missing the attribute are actually hidden.  I use for example "Yammer Root".  In the primary mail store that Outlook is using, it has the PR_ATTR_HIDDEN attribute set as true.  The other mailboxes I have attached in Outlook also list the Yammer Root folder, but the GetProperty call throws an exception. If I log directly into one of the other accounts, it does not throw the exception and shows as hidden.  So I know that it "should be" hidden, but when the account is not primary it appears to be missing the attribute at the VSTO level.  I tried to use OutlookSpy to examine the folder attributes, but as best I'm able to determine, OutlookSpy will only show folders on the mailbox that Outlook logs into directly.

    Is it expected behavior that alternate stores (Application.Session.Stores) would in some cases be missing attributes that, when primary, exist and are query-able?  If this is expected behavior, is there a way around it?  Given that Outlook knows they are hidden (they don't show up in the folder list), I'm hoping that there is.  Any advice or guidance would be appreciated here...

    Here's the code snippet I'm using for GetProperty:

    var isHiddenProp = folder.PropertyAccessor.GetProperty("");

    Thanks in advance!

    Sunday, August 4, 2019 4:22 PM