任何人都知道,如何使用vb.net在Exchange Web服务器(EWS)中找出收件箱电子邮件文件夹的名称。根据当地的特性,可以将其命名为“收件箱”(英语),“ Posteingang”(德语)等
Thx
答案 0 :(得分:0)
您可以使用以下代码来获取它:
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);
}
相关链接:Exchange Web Service FolderId for a not well known folder name
答案 1 :(得分:0)
如果您只想访问该文件夹,无论其名称是什么,都应使用WellKnownFolderName
枚举。如果确实需要知道名称,请使用WellKnownFolderName
打开文件夹,然后检索DisplayName
属性。
答案 2 :(得分:0)
根据您的建议,我终于找到了解决方案:
Dim strFolderName As String
strFolderName = Folder.Bind(objExchange,WellKnownFolderName.Inbox).DisplayName.ToString