2

I need to identify if the selected 'MailItem'(Inspector or Explorer) is an attachment of another MailItem. I've done a lot of research and I have not identified any way to do that. I need to identify if it is an attachment of another message because I would like to edit the body of the message and save those changes. But if it's an attachment I can not change the body of the message.

Anderson Rissardi
  • 2,377
  • 1
  • 16
  • 21

2 Answers2

2

Since the MailItem is being opened from an attachment, it will be read-only, according to this link. So, you can try to get the property PR_ACCESS_LEVEL from the MailItem, like this:

object accessLevel = mailItem.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0FF70003");

According to this link, it will return:

  • 0, when the MailItem is read-only;
  • 1, when it is possible to modify the MailItem.
1

The EntryID property of Outlook items will be empty (like in case of newly created items).

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45