Note that there are some explanatory texts on larger screens.

plurals
  1. POSaving only the REAL attachments of an Outlook MailItem
    primarykey
    data
    text
    <p>I'm currently developing an Outlook Addin which saves MailItems and Attachments in my MSSQL Database.</p> <p>I got a method where I save the MailItem with all it's attachments. But if I save all attachments the embedded images in the MailItem are also saved.</p> <p>Does anyone know how to save all <em>real</em> attachments?? I mean like the attachments in the picture below:</p> <p><img src="https://i.stack.imgur.com/AZ3cO.png" alt="enter image description here"> </p> <p>and not the embbeded images that are in the mail body.</p> <p>Here is the code that I use to loop through all attachments of a MailItem and then save it:</p> <pre><code>foreach (Outlook.Attachment att in mailItem.Attachments) { try { att.SaveAsFile(Path.GetTempPath() + att.FileName); var fi = new FileInfo(Path.GetTempPath() + att.FileName); //Saving attachment to DB var attachment = Attachment.NieuwAttachment(att.FileName, SelectedMap.DossierNr.ToString( CultureInfo.InvariantCulture), -1, Convert.ToInt32(SelectedMap.Tag), fi); if (!Attachment.InlezenAttachment(attachment)) continue; OutlookCategories.AddAttachmentCategory(mailItem); } catch (Exception ex) { var dmsEx = new DmsException("Er is een fout opgetreden bij het opslaan van een bijlage.", ex.Message, ex); ExceptionLogger.LogError(dmsEx); } } </code></pre> <p>Thanks!</p> <p>----------- EDIT ------------</p> <p>I also posted this question on the Microsoft TechNet and I just received an answer to the question (See link below)</p> <p><a href="http://social.technet.microsoft.com/Forums/office/en-US/3d369718-7956-4cf1-8eeb-2e92416c1fef/outlook-2007-2010-save-all-attachments-except-the-embedded-attachments-c?forum=outlook&amp;prof=required" rel="nofollow noreferrer">Outlook 2007 &amp; 2010: Save all attachments except the embedded attachments C#</a></p> <p>----------- EDIT ------------</p> <p>My problem is still not fixed, the help I got from Microsoft is useless.. So Please I really need this to be fixed!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload