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.

有帮助吗?

解决方案

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)

其他提示

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

Worked for me..

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top