EWS: How to update IsRead property of an EmailMessage
how to update IsRead
property of an Emai开发者_Python百科lMessage
using EWS or other method?
Just setting mail.IsRead=true
does not seem to persist.
OK,no one answer my question after I post it for nearly 1 hour which is quite unusual, but I just found a solution. Hope this will help others who get confused on this issue.
mail.IsRead=true;
mail.Update(ConflictResolutionMode.AutoResolve);
That's it. The key is you have to update the item or EmailMessage after setting IsRead property.
A bit late but here is a more detailed code sample:
// if the property is not loaded yet, first load it
mail.Load(PropertySet(BasePropertySet.IdOnly, EmailMessageSchema.IsRead));
if (!mail.IsRead) // check that you don't update and create unneeded traffic
{
mail.IsRead = true; // mark as read
mail.Update(ConflictResolutionMode.AutoResolve); // persist changes
}
精彩评论