S
sd
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
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