Search code examples
exchange-serverexchangewebservicesexchange-server-2010ews-managed-api

How to find folder path of a mailbox using folderId?


I have the folderId property of a folder in a mailbox. How do I find the full path of the folder using EWS?


Solution

  • You can use the PR_FOLDER_PATHNAME extended property which should contain the full path. Example:

    ExtendedPropertyDefinition FolderPath = new ExtendedPropertyDefinition(0x66B5, MapiPropertyType.String);
    PropertySet psset1 = new PropertySet(BasePropertySet.FirstClassProperties);
    psset1.Add(FolderPath);
    
    Folder FolderwithPath = Folder.Bind(service, WellKnownFolderName.Inbox, psset1);
    Object FolderPathVal = null;
    if (FolderwithPath.TryGetProperty(FolderPath,out  FolderPathVal))
    {
        Console.WriteLine(FolderPathVal);
    }