Is there a way to find out whether Folder is a WellKnownFolder?

91 Views Asked by At

I am currently fetching the WellKnownFolder and then matching with the existing FolderId. This is basically causing a lot of re-fetches as i'll have to check for each folder and WellKnownFolder.

public boolean isWellKnownFolder(String folderId, WellKnownFolderName wellKnownFolderName) {
            Folder f = Folder.bind(account, wellKnownFolderName);
            return f.getId().toString().equals(folderId);

Also, is it possible to get a WellKnownFolderName as an extended property? So i can fetch it along with initial folder fetch.

I am using this api: https://github.com/OfficeDev/ews-java-api

1

There are 1 best solutions below

0
Glen Scales On

WellknownFolderName is a strongly typed property on the folder https://learn.microsoft.com/en-us/dotnet/api/microsoft.exchange.webservices.data.folder.wellknownfoldername?view=exchange-ews-api#Microsoft_Exchange_WebServices_Data_Folder_WellKnownFolderName . It was only introduced in 2013 so you need to make sure the requested server version is set to that or higher to get that returned.

If you want to use an Extended property look at the Fid https://learn.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxprops/c213b050-6c6b-479b-a3a5-7eadbcb9b998 . While its not documented the Fid's of WellKnownFolders are static AFAIK.