简体   繁体   中英

asp.net - How to find outlook mail attachment by ContentId Property

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.

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 (click IMessage button).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM