我有一個Exchange郵箱中的文件夾,該文件夾是根的子項,由用戶創建。用戶創建的文件夾的Exchange Web服務FolderId
如何使用EWS託管API找到這樣的文件夾?
我試過使用深度遍歷,但我找不到文件夾。
由於提前
編輯:你的問題這裏是我使用來獲得用戶
ExchangeService server = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
server.UseDefaultCredentials = true;
string configUrl = @"https://yourServerAddress.asmx";
server.Url = new Uri(configUrl);
//SetView
FolderView view = new FolderView(100);
view.PropertySet = new PropertySet(BasePropertySet.IdOnly);
view.PropertySet.Add(FolderSchema.DisplayName);
view.Traversal = FolderTraversal.Deep;
FindFoldersResults findFolderResults = server.FindFolders(WellKnownFolderName.Root, view);
//find specific folder
foreach(Folder f in findFolderResults)
{
//show folderId of the folder "test"
if (f.DisplayName == "Test")
Console.WriteLine(f.Id);
}
你應該MsgFolderRoot啓動枚舉而不是根,也因爲你沒有分頁結果你枚舉將只在郵箱典型的郵箱可以包含返回第100個文件夾1000+文件夾,所以它很重要,如果你想枚舉你的結果。它很容易只是使用一個Searchfilter過濾結果,我發佈的例子中。 –
我的枚舉只爲MsgFolderRoot返回25個文件夾,爲Root返回45個,並且都不包含用戶創建的文件夾。我會嘗試你所建議的。 – tushar