[EWS] FindFolder question RRS feed

  • Question

  • I'm trying to use FindFolder to obtain the Ids of various distinguished folders.  I have used this to obtain a complete folder hierarchy using the distinguished Id "msgfolderroot" and it works fine.  But when I specify something like "inbox" or "calendar" I get a response of "Success" but no actual data, i.e. TotalItemsInView is 0.  I am copying xml from the Microsoft documentation.  What does this mean - I have no default inbox, etc.?

    Here is my code:


    <FindFolder Traversal="Shallow" xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
    <t:DistinguishedFolderId Id="inbox"/>


    Jeffrey McKay
    Monday, November 7, 2011 8:33 PM

All replies

  • With that request what it would find is SubFolders of the Inbox folder if you have no subfolders in the Inbox or you don't have rights to the Inbox folder you would get nothing returned (or if its a brand new mailbox and it hasn't been initialized). You don't really need to find the DistinguishedFolderId's eg if you just trying to use the Inbox folder you can can use the DF ids directly in a finditems etc.

    If you want to get the all the folders in the mailbox change the Traversal to Deep and start at msgfolderroot which should give you all the folders in a mailbox. The thing to watch however on 2010 is that you need to page the results in batches of 1000 as this is one of the throttling limits see the IndexedPageFolderView examples in http://msdn.microsoft.com/en-us/library/dd633627%28v=exchg.80%29.aspx


    Tuesday, November 8, 2011 3:50 AM
  • Thanks for your comments.  I guess I don't follow the purpose of "DistinguishedFolderId".  What I am trying to do is find out which folder, in the entire mailbox, is considered to be the default folder for various types of information.  For example it would be possible to create several contacts folders.  MAPI allows me a way to determine which of these is the default folder.  Same for calendar and tasks.  I thought that my code would come back with a FolderId for each DistinguishedFolderId that I specified.   Yes I did already get a complete folderlist by using msgfolderroot - works fine, and I can see my various contacts folders (and that they are contact folders), but nothing to tell me which of them is the default.


    Jeffrey McKay
    Tuesday, November 8, 2011 5:31 AM
  • The DistinguishedFolderId represents all the default folders in a Mailbox eg the default Calendar or Contacts or Inbox more importantly if your using a localized language they give you the ability to get the folder regards of the localized name. If your using MAPI its similar to what you get with getdefaultfolder

     The Mapi properties on a folder are all available via requesting extended properties. I would suggest that you look at using the EWS Managed API instead of raw XML if you just starting out with EWS (unless you have a lot of time to kill). Is there a particular piece of Mapi functionality you trying to replace with EWS it might be help to see what your trying to do in Mapi.

    The other method of getting the default folders is grab the properties such as PR_IPM_CONTACT_ENTRYID on the Root folder which will have the HexEntryId of in this case the Contacts folder then use convertid to convert it to the EWSid.


    Wednesday, November 9, 2011 2:26 AM