0

I can find email attachment from a MailMessage by ContenId like the following code :

System.Net.Mail.MailMessage objNewMail = null;
System.Net.Mail.Attachment FindAttachment = objNewMail.Attachments.First(x => x.ContentId == "ii_157d139a0005732b");

But, I want to find out the attachment from Outlook.MailItem by ContenId. I tried many times, but Outlook.MailItem do not have a property like ContentId.

Can any one help me.

Mohamed Rashid.P
  • 183
  • 1
  • 13

1 Answers1

1

Use Attachment.PropertyAccessor.GetProperty in the Outlook Object Model. PR_ATTACH_CONTENT_ID MAPI property can be accessed by its DASL property name ("http://schemas.microsoft.com/mapi/proptag/0x3712001F").

Take a look at the message and its attachments with OutlookSpy (I am its author - click IMessage button).

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
  • Can you please explain this, because I tried many times with Attachment.PropertyAccessor.GetProperty. but I am getting the following message : "cannot be parsed or has an invalid format." – Mohamed Rashid.P Oct 18 '16 at 08:01
  • Yes, It worked for me. I got a complete explanation from this question : http://stackoverflow.com/a/4693174/2862736 – Mohamed Rashid.P Oct 20 '16 at 06:56