EWS托管API:如何比较文件夹 [英] EWS Managed API: How to compare folders
问题描述
大家好,
我搜索具有指定消息ID的邮件项目。搜索应仅在收件箱和其他用户定义的文件夹中进行,而不是在"已发送项目"或"任务"文件夹中进行:
代码如下:
....
FindFoldersResults allFolders = service.FindFolders(WellKnownFolderName.MsgFolderRoot,new FolderView(100)
foreach(lFolders中的文件夹文件夹)
{
if if(folder.Id 。== WellknownFolderName.Tasks)< ------给出编译错误
继续;
//替代
如果(folder.DisplayName == WellknownFolderName.Tasks< --- ---不适用于非英语的交换设备
继续;
...对文件夹一起做一些有用的事情(
) br />
所以,问题是:我怎么能决定一个文件夹例如'task'文件夹或aby其他WellknownFolderName
Thx任何提示!> Mike
Hi everybody,
I perform a search for a mail item with a specified message id. The search should be done only in the inbox and other user-defined folders, not , for instance, in the folder 'sent items' or 'tasks':
The code looks like that:
....
FindFoldersResults allFolders = service.FindFolders(WellKnownFolderName.MsgFolderRoot, new FolderView(100)
foreach (Folder folder in lFolders)
{
if (folder.Id.== WellknownFolderName.Tasks) <------ gives compiler error
continue;
// alternative
if (folder.DisplayName == WellknownFolderName.Tasks <------ doesnot work for a non-english installation of exchange
continue;
...do something useful with the folder
}
So, the question is: How can I decide, that a folder is for instance the 'task' folder or aby other WellknownFolderName
Thx for any hint!
Mike
推荐答案
你需要获得众所周知的实际ID文件夹,以便您可以将它们与您从FindFolders收到的文件夹进行比较。只需绑定到您感兴趣的每个知名文件夹:
Hi,
You need to obtain the actual Ids of the well known folders so you can compare them to the ones you receive from FindFolders. Just bind to each well known folder you're interested in:
Folder tasks = Folder.Bind(service, WellKnownFolderName.Tasks);
FindFoldersResults allFolders = service.FindFolders(WellKnownFolderName.MsgFolderRoot, new FolderView(100));
foreach (Folder folder in lFolders)
{
if (folder.Id == tasks.Id)
{
// You have found the Tasks folder
}
}
这篇关于EWS托管API:如何比较文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!