Greg Coleson
Greg Coleson

Reputation: 121

How can I determine if an Outlook folder is public?

I need a way to determine if an Outlook folder is public. I suspect there is some property Microsoft.Office.Interop.Outlook that will allow me to do it, but I can't find it.

Upvotes: 3

Views: 956

Answers (2)

Oliver Giesen
Oliver Giesen

Reputation: 9459

If you can get at the IMsgStore interface associated with the folder in question (sorry, no idea how to do that with pure C# - I recommend Redemption) you could query the PR_MDB_PROVIDER property to see whether it is pbExchangeProviderPublicGuid.

Update based on your comment to KG's answer:

If you want to filter out the contacts that are inside your primary mailbox, just compare their StoreID with that of your default inbox folder - or simply don't enumerate folders from any other stores to begin with.

Upvotes: 1

karlgrz
karlgrz

Reputation: 14781

What you want is Exchange Web Service, specifically the FindFolder operation (see here or here for some MSDN descriptions).

Although, from the looks of it, there is no specific property that identifies whether or not the folder is "public", like @RedDeckWins mentions.

UPDATE

If you are not specifically required to use managed C# for this, you can use the Powershell Exchange Cmdlets (check this out here). Specifically, this command might be helpful:

Get-PublicFolder -Recurse | Format-List Name

Powershell is pretty easy to use by itself, but it can also be called from C#, if the server your code is running on has it installed (which, for most modern boxes, should).

If you ARE limited to C#, take a look at this StackOverflow question: List of email address to public folders in exchange

Upvotes: 0

Related Questions