3
votes

Using EWS Managed API with Office 365 (ExchangeVersion.Exchange2013_SP1 profile). When calling Folder.FindFolders for a parent folder, I get Folder.WellKnownFolderName value as null for all returned Folder objects (including well-known folders like Inbox). Other values like .TotalCount are fine.

Folder.WellKnownFolderName doc in MSDN states it should work for Exchange2013 and higher and I believe Office 365 meets this criteria.

Also, if I connect to Exchange 2010 server and set ExchangeVersion.Exchange_2010 profile, .WellKnownFolderName throws an exception rather than returns null (this is the expected behavior). So (in my understanding), depending on the version, it should either throw an exception or return non-null value for a well-known folder like Inbox.

Am I missing something?

Or maybe I should use other means to determine system folders like Inbox, Sent Items, etc?

1

1 Answers

5
votes

That property isn't returned by default not matter what version your using you have to specify a propertyset and request that the server return that for you eg

        FolderView wkfView = new FolderView(1000);
        wkfView.PropertySet = new PropertySet(BasePropertySet.FirstClassProperties);
        wkfView.PropertySet.Add(FolderSchema.WellKnownFolderName);

        service.FindFolders(WellKnownFolderName.MsgFolderRoot, wkfView);