Embedding Images into a SharePoint Designer 2013 Workflow

Posted By Posted by: Peter Williams on August 28, 2017

Objective

Recently a client requested that their Project Server workflow, as used in Project Online, required that images be embedded into the email. These images were screenshots and are used to assist in providing instructions to end users.

Background

This customer was in the process of migrating from an on-premise Project Server 2010 environment to Project Online. In their existing PS 2010 environment, the workflow was configured to include these embedded screenshots in their workflow approval notifications and all was working well. End users could view these in Outlook 2010 without issue. The workflow was a custom Visual Studio 2010 workflow.

However, when attempting to replicate this behavior in SharePoint designer, I quickly learned of challenges with working with Project Online.

Example Workflow

This example workflow shown below will assist in highlighting what was “unexpected” behavior to me initially.

Step 1

Set variable ImageURL to equal the image html tag that sources the image file from a Project/SharePoint Online document library. My Office 365 account has permission to view this file.

e.g. <img src=”https://sharepointonlinesite/Pictures/EPM%20Services.png” >

Step 2

Set variable ImageBase64 to equal the image html tag that uses a Base64 encoded image.

I used the following site to encode the desired image: http://base64image.org/

Embedding an image using Base64 encoding was my preferred option initially as there would be no need to store the file somewhere and have to worry about security. As you will later see though, I discovered an issue with this approach.

e.g. <img src=”data:image/png;base64, enter encoded value string here” >

NOTE: There is a maximum character limit for the encoded string. It seems to be around 15,000 characters.

Step 3

Set variable ImageURL_Anonymous to equal the image html tag that sources the image file from our public EPM Partners website which has anonymous access. I.e. no authentication required.

e.g. <img src=”https://www.epmpartners.com.au/wp-content/themes/epm/images/logo.png” >

Step 4

Use the Send email action. Below is a screenshot of the configuration page.

 

The Result

Below is the result of viewing the email in Microsoft Outlook desktop application when I’m NOT logged into my PC using my Office 365 account.

Below is the result of viewing the email in Microsoft Outlook desktop application when I am logged into my PC using my O365 account. NOTE: this time I can view the first image.

Below is the result of viewing the email in the browser using my O365 account. NOTE: this time I can see the base64 encoded image.

Lastly, below is the result if I select the “View in Browser” option in Microsoft Outlook client application. NOTE: I can see all the images.


Lessons Learned

If you are able to store the images in a publicly accessible site, then embedding images in emails is a straightforward process.

Using Base64 encoding has the limitation that it is blocked by the Microsoft Outlook desktop application. See this article as a reference. https://www.campaignmonitor.com/blog/email-marketing/2013/02/embedded-images-in-html-email/

NOTE: you might be wondering how it is possible to view email signatures (which usually contains embedded Base64 encoded images) in the Outlook desktop client. This is because they use the CID technique. Please refer to the following article on some details on how this is done.

https://sendgrid.com/blog/embedding-images-emails-facts/

This technique could be used successfully IF it was possible to include the base64 encoded images to the email as ATTACHMENTS. However, you can’t attach files to an email when sending email in SharePoint Designer.

Storing the image in a SharePoint document library is a viable option but only if you log into your PC using your O365 account. I would image that logging into your PC using a company Active Directory account is a viable option but only if the company’s AD is synchronized with the O365 Azure AD.  However, I could not test this. Please let me know if you can confirm this.


Blog Posted In Blog Posted In: Blog, How to, Project Online, SharePoint
Blog Posted In