Categorize the Exchange folders into Distinguished Folder and Normal Folder
My question is how to make difference between a distinguished folders and a folder created by user when I try to obtain the list of user folders using findFolder
web service method:
FindFolderType request = new FindFolderType();
request.setTraversal(FolderQueryTraversalType.DEEP);
FolderResponseShapeType folderResponseShapeType = new FolderResponseShapeType();
folderResponseShapeType.setBaseShape(DefaultShapeNamesType.ALL_PROPERTIES);
request.setFolderShape(folderResponseShapeType);
NonEmptyArrayOfBaseFolderIdsType folderIds = new NonEmptyArrayOfBaseFolderIdsType();
DistinguishedFolderIdType folderId = new DistinguishedFolderIdType();
folderId.setId(DistinguishedFolderIdNameType.MSGFOLDERROOT);
folderIds.getFolderIdOrDistinguishedFolderId().add(folderId);
request.setParentFolderIds(folderIds);
//respo开发者_JS百科nse
Holder<FindFolderResponseType> findFolderResult = new Holder<FindFolderResponseType>();
addHandlers(port);
port.findFolder(
request,
getImpersonation(smtpAddress),
getSerializedSecurityContextType(),
MAILBOX_CULTURE,
getServerVersion(),
findFolderResult,
serverVersion);
I can not see any property to distinct between these 2 types of folders.
Thank you
From http://social.technet.microsoft.com/Forums/exchange/en-US/57551bd1-d1e1-4913-bbb2-e2abbca02a3f/how-do-i-distinguish-the-user-create-folders-from-all-the-msgfolders?forum=exchangesvrdevelopment:
"Call GetFolder (IdOnly) and pass in all the enumeration values from DistinguishedFolderIdNamesType and stick the resulting FolderIds in a dictionary (FolderId.Id to Enum). Then when you want to see if a given Folder is "distinguished" or not, just check to see if the key exists in your dictionary."
精彩评论