Hi guys!
Today, I will be covering the day-five topics of my MS Flow series. If you have not checked out my previous posts about Microsoft Flow, I would recommend you have a look at it. Links to the previous posts are given below.
What I am going to cover
I am planning to write a series on MS Flow on which I will cover most of the areas in it. This will be a 10-day series:
- Day 1: Flow Templates, Connectors, Triggers, Actions, Conditions
- Day 2: The famous Twitter flow, My Flows, Team Flows, Share a Flow
- Day 3: Flow in Mobiles, Debug a flow, export, and import a flow
- Day 4: Approval Flow (sequential and parallel)
- Day 5: Flow with SharePoint on-prem (Gateways)
- Day 6: Flow vs logic apps
- Day 7: Flow with custom applications web services
- Day 8: Flow with Graph API
- Day 9: Flow with Cognitive services
- Day 10: Flow Administration and DLP, Pricing etc.
A few points before moving on to the topic.
Microsoft Flow is an online service that helps in connecting various apps and services. And those include Microsoft products like SharePoint, Dynamics, Excel, Power BI etc... and non-Microsoft services like Twitter, Facebook, MailChimp, etc.
Today, we are going to connect the online Microsoft Flow and on-prem SharePoint environment. This is going to be done using Microsoft on-prem Data Gateway.
Based on Microsoft’s definition:
The On-premises data gateway acts as a bridge, providing quick and secure data transfer between on-premises data and the Power BI, Microsoft Flow, Logic Apps, and PowerApps services.
You can use a single gateway with different services at the same time. If you are using Power BI as well as PowerApps, a single gateway can be used for both. It is dependent on the account you sign in with.
Before that, you must install .net framework (preferably 4.6).
Now, we will see how to install the Data Gateway.
Installation
Go to https://powerapps.microsoft.com/en-us/downloads/
On the lower right corner, you will find the option to download.
On clicking it, it downloads the GatewayInstall.exe.
Double-click on the .exe file and run it. You will get the below screen.
Click on Next.
Check the checkbox – “I accept the terms of use and privacy statement” and click on “Install”.
It takes a minute or two to install.
After that, it asks for your online credentials. You have to provide your flow account credentials (which is your Online SharePoint Credentials also).
It prompts for the password. Once you successfully sign-in, we get to choose between the 2 options.
- New Gateway on the computer.
- Migrate a Gateway.
I am selecting the “Register a new gateway on this computer” option. Click on “Next”.
Here, fill the name for your GateWay and the Recovery Key. In case, if you want to migrate or recover an existing GateWay in future.
Finally, we get the success message for installing the Gateway.
Now, we can close this. Our next target is on creating the flow which is going to get data from the on-prem environment.
Open your flow environment. And clicking on the gear icon settings, we can find the “Connections”.
In this page, we will see all the connections that we have used in our flows. We are going to create a new connection.
Click on “New Connection” (Connect to on-prem). This navigates to a new page.
Type “SharePoint” on the search box to filter. Now, click on the “SharePoint” connection.
Select “Connect using on-prem data gateway”. It opens the fields that have to be filled to achieve this.
Here, in the username, I am passing my on-prem Username and my password in the Password field.
In the “Choose a gateway” option, we can select based on the online environments we have. As I have only one environment, it shows my FlowArticleGateway only.
Once all these are filled appropriately, then the “Create” button at the bottom right is enabled.
Now, I can see that in my list of connections.
Now, our final step is to create flow and use this connection in it.
Click on “Create from blank” in our flow environment. If you not sure about this step, check my previous articles. Links are given at the top of this article.
In our new flow, select SharePoint as the connector and use “When an item is created” as the trigger for this flow.
This is my on-prem environment list and its URL. (http://flowsharepoint/sites/CheckFLow)
Now, in my flow, once I have entered the Site address, the list is shown in the drop-down.
My flow logic is – When a new item is created in the “FlowList”, I am going to replicate that item in the “ArticleList”.
After saving this, I am going to test it.
For this, I have created an item in “FlowList” with the Title “Day 5 C sharp corner”.
I could see the same in the “ArticleList".
Cool, right!... It works perfectly. Use cases for this will be huge once you understand this.
Thanks for reading. Will see you on Day Six.