'Set Outlook MailItem as read or suppress_receipt in PR_MESSAGE_FLAGS

What's the proper way to set a MailItem as read before opening or set the value suppress_receipt in PR_MESSAGE_FLAGS?

Looking at http://msdn.microsoft.com/en-us/library/office/cc815395(v=office.12).aspx my code is:

MailItem x = item as MailItem;
x.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E070003",35);

I got 35 from other read mails using OutlookSpy, assuming it contains the boolean flag for "Read".

Running this code gets me the exception "The operation failed". Any ideas? Thanks.



Solution 1:[1]

You cannot do that in the Outlook Object Model. On the MAPI level, you need to call IMessage::SetReadFlag(SUPPRESS_RECEIPT), but you will need C++ or Delphi for that.

If using Redemption (I am its author) is an option, you can use RDOMail.MarkRead(SuppressReceipt) (can be called from any language)

Solution 2:[2]

Use: string PR_CLIENT_READ = "http://schemas.microsoft.com/mapi/proptag/0x0E070003"; omMailItem.PropertyAccessor.SetProperty(PR_CLIENT_READ, 0x09);

Worked for me..

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Krull