Using on-premises data gateway with SharePoint 2019 and Microsoft Flow

I wanted to create a working environment with the on-premises data gateway in combination with SharePoint 2019. The scenario I configured is a simple one as it only sends a mail when a new item has been added to a library in my SharePoint 2019 farm. This scenario would present more possibilities for customers who are using SharePoint on-premises and are looking for a Workflow or PowerApp solution without having to use for example SharePoint Designer.

This post will first describe the installation of the on-premises data gateway and then the creation of the Microsoft Flow using this gateway.

Installing the on-premises data gateway

Information can be found at https://docs.microsoft.com/en-us/power-bi/service-gateway-onprem and you can download the gateway using at https://go.microsoft.com/fwlink/?LinkID=820580&clcid=0x409.
I’ve downloaded the on-premises data gateway and started the installation on a server which also hosts my Azure AD Connect tool.

Click on Next

Install to the default location (or specify a location), accept the terms and use and click on Install

Click on Yes

You will be asked the same question again and also click on Yes

Enter an Email address to use with this gateway and click on Sign in

Connect to you Office 365 Tenant and click on Sign In (Aanmelden)

Give your on-premises data gateway a name and enter a recovery key.
Click on Configure

The gateway should be created successfully and it will register itself as a gateway for your Office 365 tenant.
You can disable helping Microsoft if you like and go to Diagnostics

Start a network ports test by clicking on Start new test

It may take a while but should give the above results.
In my case it completed but failed.
Open the last completed test result.

Everything was successful except the two server names and IP.
This can be at Microsoft’s end or at my end but I decided to not troubleshoot this as it has 31 successful server names.
Now go to https://flow.microsoft.com

Configuring Microsoft Flow Connections

The Gateway should be automatically created for your tenant where you only need to create a connection.
Please go to https://emea.flow.microsoft.com/en-us/pricing/ to verify the available plans and if you can add Gateway Connections as it does not work with the free version or E1 license.

Click on the “Gear” icon and select Connections

Create a new connection

Select SharePoint but you can also use SQL Server or any of the available connections which work with the On-Premises Data Gateway

Select connecting using the on-premises data gateway and scroll down

Enter the credentials for your on-premises environment and select the created gateway.
Note that you can add multiple gateways depending on your flow plan.
Go back to the flows homepage

Creating the Microsoft Flow

Click on My Flows

Create a new Microsoft Flow

Click on Create from blank

Select When a file is created in a folder from the SharePoint available triggers

First select the connection which you are going to use

Enter the Site Address and Folder Id (you can also use the folder viewer to select a folder from your site).
Click on + New step

I’m just going to send an email using the Office 365 Outlook action

It will be sent to my personal mail account with metadata from the SharePoint 2019 library.
First click on Save and then on Test

Save & Test and add a file to your SharePoint 2019 library and wait for the Microsoft Flow to continue

The flow executed successfully and an email has been sent to my mailbox

I have added a new .txt document to verify if it also triggers without testing and this test was also successful

This “simple” scenario shows that you can communicate with your SharePoint On-Premises environment using the on-premises data gateway from Microsoft.
Microsoft Flows are being triggered by the On-Premises environment.
You can now build your complex workflows not using SharePoint Designer but using Microsoft Flow.

The logging from the on-premises data gateway also provides good information regarding your gateway.
I have verified the logs for my environment and can see that Microsoft Flow is actively polling my SharePoint on-premises library for new content.

DM.EnterpriseGateway Information: 0 : 2018-10-02T19:22:55.9955178Z DM.EnterpriseGateway 6d3ce9bd-66b1-4af9-8140-38d010ebc9a1        2e3ae2b3-44d1-49a1-89db-f33e83245d52             MGPP   983aa058-7427-4c1b-97d2-08090368600b    46EFAADE [DM.GatewayCore] Deserialized GatewayHttpWebRequest, executing

DM.EnterpriseGateway Information: 0 : 2018-10-02T19:22:55.9955178Z DM.EnterpriseGateway 4b2ee4e3-e434-4e4b-9f7e-f1e6c837a391              2e3ae2b3-44d1-49a1-89db-f33e83245d52             MWPR  983aa058-7427-4c1b-97d2-08090368600b    2BD360D1 [DM.GatewayCore] Processing http(s) request with URL: http://portal.sharepointfire.com//_api/web/GetFolderByServerRelativeUrl(@p)/Files?$filter=TimeCreated%20ge%20datetime’2018-10-02T19:00:09Z’&$orderby=TimeCreated,Name&@p=’%2fShared+Documents’

DM.EnterpriseGateway Information: 0 : 2018-10-02T19:22:55.9955178Z DM.EnterpriseGateway 4b2ee4e3-e434-4e4b-9f7e-f1e6c837a391              2e3ae2b3-44d1-49a1-89db-f33e83245d52             MWPR  983aa058-7427-4c1b-97d2-08090368600b    BB3A41D3 [DM.GatewayCore] Processing https request

DM.EnterpriseGateway Information: 0 : 2018-10-02T19:22:55.9955178Z DM.EnterpriseGateway 4b2ee4e3-e434-4e4b-9f7e-f1e6c837a391              2e3ae2b3-44d1-49a1-89db-f33e83245d52             MWPR  983aa058-7427-4c1b-97d2-08090368600b    DFE1F964 [DM.GatewayCore] Http(s) request with windows authentication

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.