MS Exchange Web服务:如何获取设置了“标志”的项目?

时间:2012-04-25 01:51:06

标签: exchangewebservices exchange-server-2007

是否有人知道如何使用Microsoft Exchange Web服务获取在收件箱中标记的所有项目

显然它们既不在Tasks文件夹中(即使它们出现在Outlook中),也没有IsReminderSet设置为 true

以下尝试仅返回约会或仅返回真实任务,但不返回标记消息:

var msgsView = new ItemView(100);
var msgsFilter = new SearchFilter.IsEqualTo(ItemSchema.IsReminderSet, true);
var flagged = exSvc.FindItems(WellKnownFolderName.Inbox, msgsFilter, msgsView);

var taskView = new ItemView(100);
var tasks = exSvc.FindItems(WellKnownFolderName.Tasks, taskView);

都不起作用。

1 个答案:

答案 0 :(得分:0)

我知道这个问题已经过时了,但我刚发现列表示例代码似乎可以解决这个问题(我还没有自己测试过) 来源:http://independentsoft.de/exchangewebservices/tutorial/findmessageswithflag.html

    IsEqualTo restriction1 = new IsEqualTo(MessagePropertyPath.FlagStatus, "1"); //FlagStatus.Complete
    IsEqualTo restriction2 = new IsEqualTo(MessagePropertyPath.FlagStatus, "2"); //FlagStatus.Marked

    Or restriction3 = new Or(restriction1, restriction2);

    FindItemResponse response = service.FindItem(StandardFolder.Inbox
                 , MessagePropertyPath.AllPropertyPaths, restriction3);

for (int i = 0; i < response.Items.Count; i++)
{
    if (response.Items[i] is Message)
    {
         Message message = (Message)response.Items[i];

         Console.WriteLine("Subject = " + message.Subject);
         Console.WriteLine("FlagStatus = " + message.FlagStatus);
         Console.WriteLine("FlagIcon = " + message.FlagIcon);
         Console.WriteLine("FlagCompleteTime = " + message.FlagCompleteTime);
         Console.WriteLine("FlagRequest = " + message.FlagRequest);
         Console.WriteLine("-----------------------------------------------");
    }
}