Get Attachment ContentID

I am trying to get the content id of mail attachments in Outlook. I am using Add-In Express for my add-in, but it has no function to get it.

I know the Redemption library, but it is not free and therefore not an option for me.

Outlook 2007+ has a PropertyAccessor that should allow me to resolve it, but I can't seem to get it to work.

Here's my code:

string uniqueId = "";
object props = a.GetType().InvokeMember("PropertyAccessor", BindingFlags.Public | BindingFlags.GetField | BindingFlags.GetProperty, null, a, null);
object[] args = new object[1];
args[0] = @"urn:schemas:mailheader:content-id";
object value = props.GetType().InvokeMember("GetProperty", BindingFlags.Public | BindingFlags.InvokeMethod, null, props, args);
if ((string)value != null) {
    uniqueId = (string)value;
}

      

"a" is an attachment sourced from the Express MailItem add-in.

It just throws the following exception: "An exception was thrown by the target of the call."

Can anyone help me?

+3


source to share


1 answer


I tried your URN too and it didn't work.

Using DASL this works: http://schemas.microsoft.com/mapi/proptag/0x3712001F



Outlook Spy has a free trial period. I would download this in the meantime (where I found this value). And even when it expires, this valuable instrument is less than the Atonement itself.

0


source







All Articles