A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Detecting if attachement is embedded or not



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 3rd 10, 09:47 AM posted to microsoft.public.developer.outlook.addins,microsoft.public.office.developer.outlook.vba,microsoft.public.outlook.program_addins
Russ Green[_2_]
external usenet poster
 
Posts: 2
Default Detecting if attachement is embedded or not

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

Ads
  #2  
Old May 3rd 10, 09:58 AM posted to microsoft.public.developer.outlook.addins,microsoft.public.office.developer.outlook.vba,microsoft.public.outlook.program_addins
Russ Green[_2_]
external usenet poster
 
Posts: 2
Default Detecting if attachement is embedded or not

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

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Detecting whether a toolbar is and should be shown Brunwin Outlook and VBA 7 March 10th 09 07:55 PM
detecting new mail in shared mailbox Mark VII Outlook and VBA 2 April 22nd 08 10:08 PM
Detecting the .ActiveWindow() w/C# Vic[_2_] Outlook - General Queries 1 October 24th 07 08:21 PM
Detecting when Appointment Occurs mwernerps2 via OfficeKB.com Add-ins for Outlook 1 October 21st 07 12:29 AM
detecting when Word is being used to compose email ? Mark Beiley Add-ins for Outlook 5 July 23rd 07 07:35 AM


All times are GMT +1. The time now is 01:10 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.