Attachment Type

N

Neetu

We are using VSTO 3.0 and Vb.net to create outlook addin for outlook 2007
We are extracting all attachments with a mail item.
iN some mail , signatures and background images are considered as attachments.

If there any way to find attachments of mail which are added as attachments
not signature image or back ground images?
 
N

Neetu

hello Ken,

I googled a lot to get information on how to use these properties of
attachments however could not get any thing relevant.

If possible can i get some sample code for this.

Thanks
Neetu
 
K

Ken Slovak - [MVP - Outlook]

If you have an attachment oAttach then the following code will access those
properties:

Outlook.PropertyAccessor prop = oAttach.PropertyAccessor;

string disposition =
(string)prop.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3716001E");

string contentID =
(string)prop.GetProperty("urn:schemas:mailheader:content-id");

if ((!String.IsNullOrEmpty(contentID)) ||
((!String.IsNullOrEmpty(disposition)) && (disposition.ToLower() ==
"inline")))
{
// is inline attachment
}
 
N

Namratha

hey Ken
thanks for your reply but we are facing a problem with this piece of code
this line string disposition
=(string)prop.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3716001E");
is throwing an error saying
The property "http://schemas.microsoft.com/mapi/proptag/0x3716001E" is
unknown or cannot be found.

And
string contentID =
(string)prop.GetProperty("urn:schemas:mailheader:content-id");
this is throwing
The property "urn:schemas:mailheader:content-id" cannot be parsed or has an
invalid format.

can you please help me out
 
K

Ken Slovak - [MVP - Outlook]

Those are named fields and may or may not be there. You have to be prepared
for that in your code, handling exceptions and testing for null or empty.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top