Reputation: 112787
In Outlook Office365, you can flag individual mail.
Toggling this flag gives an updated
-entry in the SyncFolderItems
-request. This property does not seem to be part of the Default
properties when fetching the item, or even the AllProperties
, so I guess it is an extended property.
How do I get it through EWS? I would like to support Exchange 2010.
Upvotes: 0
Views: 280
Reputation: 27861
This is the ItemSchema.Flag property.
Do something like this to read such property when you use SyncFolderItems:
var property_set = new PropertySet(ItemSchema.Flag, ItemSchema.Id);
var result = service.SyncFolderItems(folder_id, property_set, new ItemId[] { }, 10,
SyncFolderItemsScope.NormalItems, sync_state);
foreach (var result_item in result)
{
var flag = result_item.Item.Flag;
}
The flag
variable is of type Flag. Take a look at its FlagStatus member to see how to detect if the item is flagged or not.
Since this works only for Exchange 2013, here is a work around for Exchange 2010:
var flag_property = new ExtendedPropertyDefinition(0x1090 , MapiPropertyType.Integer);
var property_set = new PropertySet(flag_property, ItemSchema.Id);
var result = service.SyncFolderItems(WellKnownFolderName.Inbox, property_set, new ItemId[] { }, 10,
SyncFolderItemsScope.NormalItems, sync_state);
foreach (var result_item in result)
{
var flag = result_item.Item.ExtendedProperties.FirstOrDefault(x => x.PropertyDefinition == flag_property);
if (flag == null)
{
//Item is not flagged
}
else if((int)flag.Value == 1)
{
//Item is makred complete
}
else if ((int)flag.Value == 2)
{
//Item is flagged
}
}
This is based on the PidTagFlagStatus property. Please note that the documentation state that this will not work for meeting or task items.
Upvotes: 3