是否可以使用SearchFilter仅检索具有特定标志状态的项目? 例如,要检索所有未读项目,请使用以下搜索过滤器:
SearchFilter sf = new SearchFilter.SearchFilterCollection(LogicalOperator.And, new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false));
是否有相同的方法来检索未分配完成标志的所有项目? 感谢
答案 0 :(得分:1)
您可以使用pidTagFlagstatus扩展属性https://msdn.microsoft.com/en-us/library/office/cc842307.aspx来执行此操作,例如,如果值为2,则标记为值为1是否完整,例如
String MailboxToAccess = "user@domain.com";
ExtendedPropertyDefinition PR_FLAG_STATUS = new ExtendedPropertyDefinition(0x1090, MapiPropertyType.Integer);
ExtendedPropertyDefinition FlagRequest = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Common, 0x8530, MapiPropertyType.String);
SearchFilter sfSearchFilter = new SearchFilter.IsEqualTo(PR_FLAG_STATUS, 2);
PropertySet fiFindItemPropset = new PropertySet(BasePropertySet.FirstClassProperties);
fiFindItemPropset.Add(FlagRequest);
FolderId FolderToAccess = new FolderId(WellKnownFolderName.Inbox, MailboxToAccess);
ItemView ivItemView = new ItemView(1000);
ivItemView.PropertySet = fiFindItemPropset;
FindItemsResults<Item> FindItemResults = null;
do
{
FindItemResults = service.FindItems(FolderToAccess, sfSearchFilter, ivItemView);
foreach (Item itItem in FindItemResults.Items)
{
Console.WriteLine(itItem.Subject);
Object FlagValue = null;
if (itItem.TryGetProperty(FlagRequest, out FlagValue))
{
Console.WriteLine("Flag : " + FlagValue);
}
}
ivItemView.Offset += FindItemResults.Items.Count;
} while (FindItemResults.MoreAvailable);