简体   繁体   中英

Save embedded images from outlook in GIF format

I am trying to use Outlook object in windows service to read mails from a inbox and then extracting embedded images. But mail can have any type of images embedded in it. Is there any easy method in outlook API where i can save all the embedded in GIF Format?

 if (newEmail.Attachments.Count > 0)
            {
                for (int i = 1; i <= newEmail
                   .Attachments.Count; i++)
                {
                    string value = newEmail.Attachments[i].PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E");

                    if (!String.IsNullOrEmpty(value))
                    {
                    newEmail.Attachments[i].SaveAsFile
                        (@"C:\TestFileSave\" +
                        newEmail.Attachments[i].FileName);
                    }
                }
            } 

You cannot use Outlook Object Model in a service. Why not create a COM addin.

You are also checking for the presence of the PR_ATTACH_CONTENT_ID property. Keep in mind that Content-ID MIME header can be set on any attachment, it is not necessarily an image, you'd need to check the HTML body for that.

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