email - Outlook VBA link to moved mail -
i want move mail item different folder , return link moved mail. without moving works as:
dim objmail outlook.mailitem dim sfrag string set objmail = application.activeexplorer.selection.item(i_item) sfrag = "<a href='outlook:" + objmail.entryid + "'>" + objmail.subject + "</a>""
here there string sfrag
provides on proper hyperlink to valid outlook element. if click on hyperlink containing property element opened in outlook.
however if extend to:
dim objmail outlook.mailitem dim sfrag string dim oolapp outlook.application dim targetfolder folder set objmail = application.activeexplorer.selection.item(i_item) set oolapp = outlook.application set objnmspc = oolapp.getnamespace("mapi") set targetfolder = objnmspc.pickfolder objmail.move targetfolder sfrag = "<a href='outlook:" + objmail.entryid + "'>" + objmail.subject + "</a>"
after link in sfrag
fails. if want open link, outlook-windows displays operation failed
. seems objmail.entryid
not updated correctly after objmail.move
command.
why? how fix this?
move function, not sub - retruns new item:
set objmail = objmail.move(targetfolder)
Comments
Post a Comment