Giridharan J
Giridharan J

Reputation: 147

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?

Upvotes: 0

Views: 1395

Answers (1)

Glen Scales
Glen Scales

Reputation: 22032

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);
}

Upvotes: 5

Related Questions