Category Archives: Uncategorized

Microsoft Flow: How to embed an image in an email

Microsoft Flow: How to embed an image in an email

It’s simple when you know how!


Using Microsoft Flow, trigger sending of an email with an embedded image.

  • The image will be stored in a SharePoint Library
  • We will assume you have already created connects to:
    • Office 365 Outlook
    • SharePoint


  1. Create a new Flow:
    1. Select: +New > Instant—from blank
    2. Click: Manually trigger a flow
  2. Add the 1st actions:
    1. Search for SharePoint > Get file content using path
    2. Select the action
    3. Site Address: either select or ‘enter custom value’
    4. File Path: enter the path from the site collection (e.g. ‘/Style%20Library/_Company/Images/EmailSignature.jpg’)
  3. Add the 2nd actions:
    1. Search for Variables > Initialize variable
    2. Select the action
    3. Name: Enter ImageTag
    4. Type: Select String
    5. Value: This is the trick bit!*
      1. Enter: <img src=”data:image/jpeg;base64,” alt=”My Image” />
      2. Next click between ‘64,‘ and ‘” alt
      3. Add dynamic content
      4. Select: Expression fx
      5. Enter .$content
      6. Placing you cursor before the .$content click: Dynamic content
      7. Locate and select File Content
      8. Click OK
  4. Add the 3rd and last actions:
    1. Search for Office 365 Outlook > Send an email
    2. Select the action
    3. To: enter your email address
    4. Subject: Microsoft Flow: How to embed an image in an email
    5. Body: <p>This is my test email, you should see an image below</p><p></p>
    6. Click between the last <p></p> tags
    7. Click: Add dynamic content
    8. Locate and select the ImageTag variable
    9. Is HTML: Select Yes
  5. Save the Flow

*Here is the full code/expression:

<img src="data:image/jpeg;base64,@{body('Get_file_content_using_path')['$content']}" alt="My Image" />

So what tripped me up?

On my first attempt I tied using the File Content variable directly within the body of the email, only to see binary… Note: This works fine when attaching the file as an ‘attachment’ (see Attachments Content).

Plus I struggled to find a way to convert binary to base64. That was before I realised I didn’t need to do all that work, hence this blog post…

Newtonsoft Version conflicts with Azure Function & PnP-Sites-Core

Compilation Warnings

Warning NU1608 Detected package version outside of dependency constraint: Microsoft.NET.Sdk.Functions 1.0.24 requires Newtonsoft.Json (= 9.0.1) but version Newtonsoft.Json 10.0.3 was resolved.

The Cause:

The Function App references a Business Layer project, which references the OfficePnP.Core NuGet package, which Newtonesoft.Json version 10.0.3

The Function App reference the Microsoft.NET.Sdk.Functions (version 10.0.24), which unfortunately references the Newtonesoft.Json version 9.0.1

The project builds with the NU1608 Warning, and causes the following code to throw an error:

XMLTemplateProvider provider = new XMLFileSystemTemplateProvider(templateFilePath, string.Empty);
ProvisioningTemplate template = provider.GetTemplate(templateFileName);

The “Fix”:

I have manually updated the Function Apps .CSProj file to include the following reference:

<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />

This causes the Dependency and NuGet folders to show a warning triangle, however the project builds and the PnP ProvisioningTemplate loads OK.

More Information:

I also attempted a downgrade of the Business Layer project SharePointPnPCoreOnline NuGet reference to version: 2.24.1803 (this references Newtonesoft.Json version 9.0.1), however the following code failed to work:

ProvisioningTemplate template = provider.GetTemplate(templateFileName);

MSBuild task for Azure Functions

Access denied – refresh all published content types on next update

Working with the Content Type Hub and publish (syndicate) content types to other site collections; have you received an Access Denied message when selecting the “Refresh all published content types on next update”?

Well it turns out that you are denied access because the DenyAddAndCustomizePages is set to TRUE for that site collection.

To grant access to the “Refresh all published content types on next update” functionality you need to set the “Deny Add and Customize Pages” fag to false. This can be done simply, by running the following PowerShell:

Set-SPOsite -DenyAddAndCustomizePages 0;

Troubleshooting SPFx Webparts: Useful Links

Based upon the App Catolog (Catalogue) being configured with the following URL:

Apps for SharePoint
A catalog to store apps for SharePoint

Client Side Assets
A library to store client side assets

Client Side Component Manifests
A list to store client component manifests

Configure Visual Studio Code with VSTS

Visual Studio CodeWhile in the process of setting up a new environment I thought I would share the steps I took to configure Visual Studio Code (VS-Code) with Visual Studio Team Services (VSTS) online.


  1. Navigate to:
  2. Select the relevant version for your machine e.g. macOS or Windows x64 and click Download
  3. Double click on the installer, if it doesn’t automatically open, follow the wizard
  4. Open Visual Studio Code (VS-Code)
  5. Click on the Extensions icon (left hand side)
  6. Search for Visual Studio Team Services and click Install


  • Click on Source Control icon (left hand side)
  • Click on Initialize Repository icon (top-left hand side)
  • Select a folder in which to store the code. For example: C:\Code\Project
  • Click Initialize Repository
  • You will have two options to authenticate: Manually provide a Key or Automatically provide a key…

Manually create a VSTS access token

If you’re not prompted for your Username and Password, follow these instructions on how to create personal access tokens to authenticate access:

For ease of use I would recommend using the Automatic approach, however here is how to manually create a VSTS access token.

    • Sign in to either your VSTS account
    • from your home page; click on your profile icon and then security details
    • Click Personal access tokens (left hand side) and Add
    • Enter the following:
      • Description: e.g. Bob’s VS-Code Win 10
      • Expires in: e.g. 90 days
      • Accounts: e.g. select the default
      • Authorized Scopes: e.g. All scopes
      • Click Create Token
      • Make a copy of token, e.g. werwqefslz2hhldesdfwfwvsdafqfq2aadsfdpalaifa5ppuyikuik
      • Back to VS-Code
      • Enter the code…

Supporting information

Siôn Lewis


Following Microsoft’s announcement that they are phasing out the Public SharePoint Online sites I’ve moved my blog to WordPress.