View Single Post
  #2  
Old August 14th 09, 03:11 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Original Attachment not removed

Try saving the item after you add your new attachment and again after you
remove the old one.

--
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" wrote in message
...
hello

I've VSTO Addin for Outlook 2007.
I'm adding a dummy attachment in BeforeAttachment event & removing
original attachment.
But the attachment list still shows me original attachment along with
dummy attachment.
Besides this when I drag drop or insert attachment the cursor position
changes.
I also need to insert a link at current cursor position.so the cursor
position should not change
for proper link insertion.
Below is the code I'm using -

strMyTmpFilePath = IO.Path.Combine(strMyTmpFilePath,
strMyTmpFileName)
IO.File.AppendAllText(strMyTmpFilePath, "this is a dummy
file")
CurrentMailItem.Attachments.Add(strMyTmpFilePath)
IO.File.Delete(strMyTmpFilePath)
Cancel = True
'Code to add Link at cursor position
Dim ObjSel As Object = CurrentInsp.WordEditor.Application.Selection
With ObjSel
Dim Rg As Object
.MoveRight(Unit:=2, Count:=1) 'wdWord=2
Rg = .range
.Hyperlinks.Add(Anchor:=Rg, Address:=strAttachmentURL _
, TextToDisplay:=strNewLink.ToString)
.InsertAfter(" ")
End With
If Rg IsNot Nothing Then Marshal.FinalReleaseComObject(Rg)
If ObjSel IsNot Nothing Then Marshal.FinalReleaseComObject(ObjSel)


Thanks


Ads