none
Exchange web service Folder Hierarchy reading RRS feed

  • Question

  • Hi,

    I have a requirement where i need to read the folder structure of the each user mail box.For example i have a folder inbox and inside the inbox i have a Test folder.I need to get the out out as Inbox/Test.If any body is having idea please share me the code how we can read the folder hierarchy from mailbox.

    Thanks,

     

    Venugopal

    • Moved by John Saunders Thursday, May 19, 2011 3:31 PM Exchange q (From:ASMX Web Services and XML Serialization)
    Thursday, May 19, 2011 8:37 AM

All replies

  • Hello Venugopal,

    Please provide us with more background information. It will help the community answer you questions. 

    If the application is accessing other people's mailboxes, then you will need to use either delegate access or Exchange Impersonation.

    There are a couple of ways to perform this. The application can use SyncFolderHierarchy if the entire folder hierarchy needs to be read and kept up to date on the client. Or, you could use FindFolder to find the target folders in the mailbox.

    With regards,


    Michael | Microsoft Exchange SDK

    The Exchange Development Forum Guide has useful information for using the Exchange Development Forum.

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Thursday, May 19, 2011 3:49 PM
    Moderator
  • Hi,

    If you are using exchange 2010, you can simply use get-mailboxfolder cmdlet to retrive the folder structure of the mailbox:

    Open exchange management shell, type:

    get-mailboxfolder -identity username -recurse

    To save the result as a txt file or csv file:

    get-mailbox|get-mailboxfolder -recurse |out-file c:\folderStructure.txt

    get-mailbox|get-mailboxfolder -recurse |export-csv c:\fs.csv

    For exchange 2007:

    get-mailboxfolderStatistics -identiy username |ft folderpath

     

     


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Thanks Gen Lin-MSFT
    Monday, May 23, 2011 6:43 AM
    Moderator
  • Thanks Gen for reply.But my requirement is some thing like i need to access the mailbox folder structure through exchange web service for each user mail box in my c# code.
    Venugopal
    Monday, May 23, 2011 11:13 AM
  • Hi Michael,

    Thanks for your valuable input.Can you please share with me some sample code how we can read by using the SyncFolderHierarchy?


    Venugopal
    Monday, May 23, 2011 11:15 AM
  • Hello Venugopal,

    I provided a link in my original response to the  SyncFolderHierarchy topic that contains a code sample. You will need to alter the code to specify your target folder.

    ChangeCollection<FolderChange> fcc = service.SyncFolderHierarchy(new FolderId(WellKnownFolderName.Inbox), PropertySet.FirstClassProperties, null);

    Change the bolded line to match the target folder.

    With regards,


    Michael | Microsoft Exchange SDK

    The Exchange Development Forum Guide has useful information for using the Exchange Development Forum.

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Monday, May 23, 2011 4:32 PM
    Moderator