Group:  Microsoft Outlook ยป microsoft.public.outlook.program_addins
Thread: show attachment file path as link in message body

Geek News

show attachment file path as link in message body
sd <dshubhangi[ at ]gmail.com> 11/3/2008 12:53:25 PM
hello
I've VSTO addin for Outlook 2007.I need to override the standard
behavior of drag and drop of attachments.
in message compose.Cancel the attachment add operation ,save the
attachment file in temp. folder & show
the file path as a link in message body.

I'm using below code
Private Sub CurrentMailItem_BeforeAttachmentAdd(ByVal Attachment As
Microsoft.Office.Interop.Outlook.Attachment, ByRef Cancel As Boolean)
Handles CurrentMailItem.BeforeAttachmentAdd

Dim strTmpFilePath As String
If bsent = True Then Exit Sub
strTmpFilePath =
System.IO.Path.Combine(System.IO.Path.GetTempPath, "Attachment")
strTmpFilePath = System.IO.Path.Combine(strTmpFilePath,
Attachment.FileName)
Try
Attachment.SaveAsFile(strTmpFilePath)
Catch ex As Exception
MsgBox(ex.Message)
End Try

CurrentMailItem.Body += gblSeparator & strTmpFilePath
Cancel=true
End Sub
The problem is that Message body doesn't show the filepath
(strTmpFilePath).When I checked body prop. through OutlookSpy,it
contains
the filepath but it is not reflected in message body.

Thanks in advance
Re: show attachment file path as link in message body
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 11/3/2008 2:05:53 PM
Try saving the item.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"sd" <dshubhangi[ at ]gmail.com> wrote in message
news:622e093a-ec08-4977-9563-1822342b0193[ at ]i18g2000prf.googlegroups.com...
[Quoted Text]
> hello
> I've VSTO addin for Outlook 2007.I need to override the standard
> behavior of drag and drop of attachments.
> in message compose.Cancel the attachment add operation ,save the
> attachment file in temp. folder & show
> the file path as a link in message body.
>
> I'm using below code
> Private Sub CurrentMailItem_BeforeAttachmentAdd(ByVal Attachment As
> Microsoft.Office.Interop.Outlook.Attachment, ByRef Cancel As Boolean)
> Handles CurrentMailItem.BeforeAttachmentAdd
>
> Dim strTmpFilePath As String
> If bsent = True Then Exit Sub
> strTmpFilePath =
> System.IO.Path.Combine(System.IO.Path.GetTempPath, "Attachment")
> strTmpFilePath = System.IO.Path.Combine(strTmpFilePath,
> Attachment.FileName)
> Try
> Attachment.SaveAsFile(strTmpFilePath)
> Catch ex As Exception
> MsgBox(ex.Message)
> End Try
>
> CurrentMailItem.Body += gblSeparator & strTmpFilePath
> Cancel=true
> End Sub
> The problem is that Message body doesn't show the filepath
> (strTmpFilePath).When I checked body prop. through OutlookSpy,it
> contains
> the filepath but it is not reflected in message body.
>
> Thanks in advance

Re: show attachment file path as link in message body
sd <dshubhangi[ at ]gmail.com> 11/4/2008 11:03:56 AM
Thanks Ken ,But saving the item also doesn't refresh message body.Is
there any other way to show attachment file paths ( as I've saved them
in temp folder by cancelling outlooks BeforeAttachmentAdd event) in
message body?
Re: show attachment file path as link in message body
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 11/4/2008 3:06:32 PM
You can of course get the HTMLBody of an item and do string parsing looking
for a src: reference that refers to that attachment and then put whatever
text you want in the HTMLBody. The same could be done using Body for plain
text items.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"sd" <dshubhangi[ at ]gmail.com> wrote in message
news:e68a2f4a-047c-4e70-86e1-4b9a63528fbf[ at ]r15g2000prh.googlegroups.com...
[Quoted Text]
> Thanks Ken ,But saving the item also doesn't refresh message body.Is
> there any other way to show attachment file paths ( as I've saved them
> in temp folder by cancelling outlooks BeforeAttachmentAdd event) in
> message body?

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net