Hyperlink detection in Outlook - outlook

I am developing an Outlook web addins that involves extracting all hyperlinks from the mail message. I am currently doing it by getting all a tag elements.
var htmlParser = new DOMParser().parseFromString(asyncResult.value, "text/html");
var urls = htmlParser.getElementsByTagName("a");
However, I found out that Outlook for PC displays text as a hyperlink as long as it contains www., even though the text is not meant to be a hyperlink. For example, I tried sending myself an email with www.example.com as the content and I ensured that it is not a hyperlink when I sent it out.
In Outlook on the web, the text is indeed not a hyperlink.
But then in Outlook for PC, the text was displayed as a hyperlink automatically. Since I did not send it out as a hyperlink, it does not have an a tag and hence my addin could not extract this "hyperlink". Is there a way to also extract these "hyperlinks" in a mail message?

You could use the getEntitiesByType API to get any URL entities identified in the mail body. A sample API call is:
Office.context.mailbox.item.getEntitiesByType(Office.MailboxEnums.EntityType.Url)

You can use this Outlook add-in - Mail add-in for a read scenario which finds and parses all links in the body of an email. Here's the documentation/sample # https://github.com/OfficeDev/Outlook-Add-in-LinkRevealer

Related

Outlook automatically print attachment pdf

I would need to automatically print a pdf attachment that comes from a specific recipient in outlook 2016. Only the attachments. I have managed by rule to print the body of the message but NOT THE ATTACHED PDF. Thanks in advance.
I found this page for you. There you can find plugin you can buy or you can customise Outlook yourself
How to Automatically print mails and attachment
Let scroll to Method 2: Using Outlook to Automatically Print Email Attachments
Then, you will only deal with the attachment name (detecting .pdf at the end) or its content type from the VBA code or the mail headers ...

How to prevent base 64 format signature images being dropped in Outlook Web App when updating the email body with Office.js?

I’m working on an add-in for Microsoft Outlook to add content to a draft email in compose view.
Our add-in fetches the existing content of the draft with the Office.js method Office.context.mailbox.item.body.getAsync() using a coercion type of HTML, adding our new content to the HTML that is returned, and then replacing the draft email’s body with our updated HTML using the method Office.context.mailbox.item.body.setAsync() with a coercion type of HTML again.
It looks like when we do this from inside the Outlook Web App, any base 64 format images in the signature are dropped when we set the email’s body using the setAsync() method. Looking at the email body html, I see that the element still exists in the email, but it has no src attribute anymore.
Is there anything we can do to prevent these images from being lost?
I’ve noticed in the Office.js documentation there is a prependAsync() method to prepend content to the email body without changing the rest of it. Is there a way to reliably append content to the end of the email body too? If so, we could use that as a workaround in our case.
Inserting base 64 encoded images is currently not supported in the Outlook Add-in platform. However, we track Outlook add-in feature requests on our user-voice page. Please add your request there. Feature requests on user-voice are considered when we go through our planning process.

Microsoft Flow Add Outlook attachment to VSTS Work Item

I'm trying to get an Outlook attachment uploaded to VSTS (using the Send an HTTP request to VSTS action). I have everything else working. Including added the attachment to the ticket, but the "uploaded" file is nothing. I've tried every combination of expression to convert the attachment content, no luck. I'm sure I'm just missing some intermediary step.
Here's the "Create Attachment" step I'm using to upload the image before updating the Work item. (The Content in the Body field was just one attempt. From the linked Outlook attachment doc, its type is "byte".)
And here's the work item, with said attachment, but there is no file content.
Any help or suggestions are welcome.
You could check VSTS rest api of Uploads an attachment here:
POST https://{accountName}.visualstudio.com/{project}/_apis/wit/attachments?fileName={fileName}&uploadType={uploadType}&areaPath={areaPath}&api-version=4.1
If you want to upload a text file, the api is as below:
POST https://fabrikam.visualstudio.com/_apis/wit/attachments?fileName=textAsFileAttachment.txt&api-version=4.1
"User text content to upload"

using ckEditor to send emails, problem with images

I'm using the ckEditor (http://docs.cksource.com/CKEditor_3.x).
my goal is to send the the text entered as an email message.
I get the contents of the editr as suggested in the docs:
var message = CKEDITOR.instances.editor1.getData();
then send the message to a webmethod on the server side, and it sends ok.
the problem is: the images are added as an img tag, and get the local directory address, so it cannot be viewed on the recipients side.
how can I add the images to the email message?
thanks in advance!
You need to use a file uploader. CKFinder integrates nicely with CKEditor. Free for demo use (and open source projects I think), but about $70 for commercial use.

Hyperlink in email can't display normally in outlook 2003

I am developing a project to send email. The email is stored in html format as a template. I use that template and replace necessary fields in html, then send it by a component.
The hyperlink in the email displays as plain text in Outlook 2003, but it is a hyperlink in Outlook 2007.
"I have solved this case. Outlook2007 will generate hyperlink for string which contains "http://" or "#hotmail.com" etc. automatically. However,Outlook2003 will not. So, my source code is incorrect at the very start. I should given it a "" container beforehand. – Domi.N.Zhang Mar 26 '11 at 1:01"

Resources