Detecting if attachement is embedded or not

  • Thread starter Thread starter Russ Green
  • Start date Start date
Status
Not open for further replies.
R

Russ Green

I've seen lots of discussion on this but no answers.

I have an addin (VB.NET and VSTO) that strips attachements from emails as

they are sent. Trouble is, I don't want to strip attachement (usually

images) that are within the body of the message. I quite often paste images

from the clipboard into my HTML messages and these need to be retained.

So when looping through the attachments in a message how can you robustly

check if the attachment is embedded or not?

Based on other articles I've seen I thought something like this might work

by actually oAttachments.Type doesn't seem to be any different between an

attached XLS file and an embedded JPG file.

Private Function HasNonEmbeddedAttachements() As Boolean

Dim retval As Boolean = False

Dim oAttachment As Outlook.Attachment

If m_olMailItem.Attachments.Count = 0 Then

retval = False

Else

For Each oAttachment In m_olMailItem.Attachments

If oAttachment.Type = Outlook.OlAttachmentType.olByValue

Then

retval = False

Else

retval = True

Exit For

End If

Next

End If

Return retval

End Function
 
May have found a simple way.....seems to work at least but will test for a

while first

Private Function HasNonEmbeddedAttachements() As Boolean

Dim retval As Boolean = False

Dim oAttachment As Outlook.Attachment

If m_olMailItem.Attachments.Count = 0 Then

retval = False

Else

For Each oAttachment In m_olMailItem.Attachments

If m_olMailItem.HTMLBody.ToLower.Contains("cid:" &

oAttachment.FileName) = True Then

retval = False

Else

retval = True

Exit For

End If

Next

End If

Return retval

End Function
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
E Issue with detecting changes in a folder. Outlook 2003. Outlook VBA and Custom Forms 3
Q Re: Detecting whether a toolbar is and should be shown Outlook VBA and Custom Forms 5
E Copying data from e-mail attachement to EXCEL file via macro Outlook VBA and Custom Forms 38
A saving attachement to folder named the same as rule name Outlook VBA and Custom Forms 0
J Customize Attachement Security Warning Using Outlook 1
K cant read email or open attachement Using Outlook 0
R compare folder contents to e-mail attachement Using Outlook 1
J How to open PDF attachement upon arrivel new mail Using Outlook 20
A PDF Attachement Errors with Outlook 2010 Using Outlook 7
S Save Attachement from outlook Using Outlook 2
G Converting Attachement into Link. Outlook VBA and Custom Forms 1
H Outlook 365 issue getting details from embedded files, crashing routine Outlook VBA and Custom Forms 0
J Outlook 2016 Can't display some embedded HTML images in Outlook 2016 Using Outlook 2
S HTML Code Embedded in String Within Open Outlook Email Preventing Replace(Application.ActiveInspector.CurrentItem.HTMLBody From Working Outlook VBA and Custom Forms 4
F Forward incoming email with 4 embedded images in the body without original sender Outlook VBA and Custom Forms 22
P Sending email from outlook IMAP to GMAIL where embedded images are added as attachment Using Outlook 1
K Embedded photos no longer open with Photos or Photo Viewer Using Outlook 7
D Reply with a template loose the sender's embedded image Outlook VBA and Custom Forms 0
X I have met my waterloo trying to resolve embedded graphics problem with outlook 2007 and now 2016 Using Outlook 1
O Non-standard fonts - are they embedded? Using Outlook 2
S Email Format With Embedded Images and Tables Change Using Outlook 2
Q Why can't I copy image with embedded hyperlink from email to Word Using Outlook 0
E Embedded form in email Using Outlook 1
R Deleting Attachments(embedded) in Outlook 2013 Using Outlook 10
R How can I retain embedded object with voting button reply? Using Outlook 5
R Outlook 2007 not displaying embedded images in emails Using Outlook 1
N Outlook refuses to show embedded images on Citrix Windows 2008 R2 Using Outlook 29
D Use Outlook 2003 embedded imaged cannot print from the mail preview list Using Outlook 4
M Save embedded image in native format Using Outlook 6
S Embedded links Using Outlook 1
V Can't click on embedded link in Outlook e-mails--error message "not allowed" Using Outlook 6
K loop through distribution group (and potentially, embedded DGs) by Outlook VBA and Custom Forms 1
T Saving Embedded Images in Outlook 2007 Outlook VBA and Custom Forms 3

Similar threads

Back
Top