我试图找到共享邮件的“收件箱”文件夹的子文件夹的唯一ID,该子文件夹名为“已处理”。在使用WellKnownFolderName.Root和深度遍历时,我发现了很多不同的文件夹。但是使用WellKnownFolderName.Inbox会显示0个文件夹,就好像Inbox文件夹中有0个子文件夹一样。
ExchangeService Service = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
Service.UseDefaultCredentials = false;
Service.Credentials = new WebCredentials("xxxx", "xxxx");
Mailbox ProdSupportMailbox = new Mailbox("xxxx");
Service.AutodiscoverUrl("xxxx");
FolderView view = new FolderView(100);
view.PropertySet = new PropertySet(BasePropertySet.IdOnly);
view.PropertySet.Add(FolderSchema.DisplayName);
view.Traversal = FolderTraversal.Deep;
FindFoldersResults findFolderResults = Service.FindFolders(WellKnownFolderName.Inbox, view);
// Find specific folder
foreach(Folder f in findFolderResults)
{
if (f.DisplayName == "Processed")
Console.WriteLine(f.Id);
// etc