Search code examples
c#outlookhtml-emailemail-attachments

PropertyAccessor SchemaName (Outlook MailItem attachment)


I'm trying to generate Outlook HTML-Mail with embedded image from my C# application. I've found out that I have to attach the image and referencing it in the HTML.

I've got these lines from here:

string imageCid = "image001.jpg@123";

 attachment.PropertyAccessor.SetProperty(
 "http://schemas.microsoft.com/mapi/proptag/0x3712001E"
, imageCid
);

 newMail.HTMLBody = String.Format(
 "<body><img src=\"cid:{0}\"></body>"
, imageCid
);

What I don't get is that schema "url" for the SetProperty Method. I don't have any clue how this comes together. MSDN tells that this is the way to specify the Property that I want to set, but how do I get to that 0x... id?


Solution

  • See http://www.dimastr.com/redemption/utils.htm#xmapi for an overview of the MAPI property tags, both fixed and named. DASL property names are not really MAPI specific, they are just a way to encode in a single string value fixed (4 byte int) and named (GUID + string or integer id) MAPI property tags.

    You can see DASL property names in OutlookSpy (I am its author) - select a message, click IMessage button on the OutlookSpy ribbon, select the property that you are after, look at the DASL edit box.