Description: We are having the technical difficulties to route the public folder hierarchy if there is a Journal folder, and we are thinking the workaround to use grapy API to do this, but didn't find the information to use Graph API to access the public folder, anyone can share more information would be appreciated.
Environment: Exchange online public folder. And there is one journal folder and one sub folder under the journal folder.
Method: Folder.FindFolders EWS API to route the public folder hierarchy.
Exception: error code: ErrorCannotUseFolderIdForItemId, error: Microsoft.Exchange.WebServices.Data.ServiceResponseException: Expected an item Id but received a folder Id.
Following is the sample code:
public static void GetPublicFolders(Folder parentFolder, int pageSize, int offset, string parentFolderPath)
{
try
{
FindFoldersResults result;
do
{
FolderView folderView = new FolderView(pageSize, offset);
folderView.Traversal = FolderTraversal.Shallow;
result = parentFolder.FindFolders(folderView);
foreach (Folder folder in result)
{
var path = parentFolderPath + @"\" + folder.DisplayName;
System.Console.WriteLine(path);
GetPublicFolders(folder, pageSize, 0, path);
}
offset += pageSize;
}
while (result.MoreAvailable);
}
catch (Exception ex)
{
System.Console.WriteLine(ex);
}
}
Thank you. Long
A fix is roling out!
This is a problem caused by the Microsoft Exchange WebServices
(EWS) of Office365
.
As per Microsoft they have found the failure on their Serverside.
Take a look at the comment from Davster
(a MS developer) at GitHub (GitHub - EWS MangedAPI issue 204)