PC Review


Reply
Thread Tools Rate Thread

Detecting if attachement is embedded or not

 
 
Russ Green
Guest
Posts: n/a
 
      3rd May 2010
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

 
Reply With Quote
 
 
 
 
Russ Green
Guest
Posts: n/a
 
      3rd May 2010
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

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: Detecting missing embedded media links programmatically or in batc John Wilson Microsoft Powerpoint 0 25th Oct 2009 08:28 PM
Detecting Windows XP Embedded vs Windows XP =?Utf-8?B?RGFuR28=?= Windows XP Embedded 1 16th Oct 2007 04:09 AM
Application Detecting XP Embedded VS XP Professional =?Utf-8?B?YnZhbmRldHRl?= Windows XP Embedded 2 21st May 2005 06:01 AM
Edit Embedded Word Document OR::: Batch remove embedded docs & creat linked file Sharper Microsoft Access Forms 0 30th Jan 2005 12:15 PM
Edit Embedded Word Document OR::: Batch remove embedded docs & creat linked file Sharper Microsoft Access Forms 0 30th Jan 2005 12:15 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:44 AM.