c# 4.0 - how to add a new option to context menu of hyperlink in an email for Outlook 2010? -
i did add new menuitem hyperlink context menu. need find hyperlink right-clicked.
what got whole email item office.iribboncontrol.context, outlook.explorer 1 selection. selection turns out outlookitem.
it have email body. may have multiple hyperlinks in inside it. must way hyperlink because other menu items work: open, select, copy hyperlink.
any ideas?
sunday has passed, sorry. i´ve had same problem , found following solution:
public void oncustomhyperlinkmenuclick(iribboncontrol control) { explorer explorer = control.context explorer; if (explorer != null) { document document = explorer.activeinlineresponsewordeditor; if (document != null && document.windows != null && document.windows.count > 0) { microsoft.office.interop.word.selection selection = document.windows[1].selection; if (selection != null && selection.hyperlinks != null && selection.hyperlinks.count > 0) { hyperlink hyperlink = selection.hyperlinks[1]; string hyperlinkurl = hyperlink.address; dosomethingwithurl(hyperlinkurl); } } } }
you need add reference word interop assembly "microsoft.office.interop.word.dll" outlook add in project.
Comments
Post a Comment