Currently I'm making an add-in that can copy various things from websites and paste them directly into the body of the email. Normally when I CTRL-C a hyperlink and CTRL-V into the body of the email, it shows up as a hyperlink (blue-underlined text). But if I paste the hyperlink through my add-in, it pastes the link as text only, the link gets removed.
Here is what I'm using for getting the data from the clipboard:
var url = window.clipboardData.getData("Text");
Office.context.mailbox.item.body.setSelectedDataAsync(url);
I'm thinking the problem is in the:
var url = window.clipboardData.getData("Text");
because it just takes the hyperlink in the clipboard and just pastes the "Text" version of it.There might also be some security issues which might be blocking pasting the hyperlink through the add-in.
I've also tried using:
var url = window.clipboardData.getData("URL");
But it just pastes a value of "null" in the body. I know these getData methods have been deprecated as of Microsoft Edge, but as I'm aware they should still work for all Internet Explorers.
Is there any other method I'm not aware of that can get the hyperlink from the clipboard and paste it as a hyperlink and not just the name/text part of it? Thanks!