Azure Functions – Part 2 – Azure functions + SharePoint + Microsoft Flow

Pankaj Salunkhe

Pankaj Salunkhe

Technical Specialist at CG
Microsoft Certified Solution expert in SharePoint and O365 with 9+ years of experience.

write to admin@sharecareinspire.com for contribution
Pankaj Salunkhe

Latest posts by Pankaj Salunkhe (see all)

> Part 1      >> Azure     >> O365

In previous part we have seen introduction of Azure Functions. Let’s take discussion one step further and see how we can call Azure Functions from SharePoint using Microsoft Flow .

This article, I am splitting in three sections as follows.

  • Create Azure functions
  • Create Microsoft Flow and consume Azure Function in Flow
  • Integrate Flow with SharePoint Online

Lets see each step in detail.

Create Azure Function

New Function App

Azure functions can be created using Function App service provided in Azure under compute category.

Hence to create new function select New -> Compute  -> Function App

This step will create function app, under which we can create multiple functions.

New Function

In above step we have created Function app, now to create function under this app, expand  default app and in functions tab click on + button.

Azure Provides multiple types and language options to create functions, select desired scenario for which you want to create function and language in which you want to create function.

You will be presented with default and ready to use function, which accepts name as a parameter and return output as “Hello Name”.

you can make changes to the function and also test in Azure Portal itself.

Create SharePoint List

Next step is to create SharePoint list, which can trigger flow on creating new item, I created custom list called “DemoList”.

 

to integrate Microsoft Flow to SharePoint list, click on flow link at the top menu of the list. you will be redirected to https://flow.microsoft.com

Create Microsoft Flow

Create Blank Flow

For this article i have selected blank flow. here we have to trigger flow when new items is created in SharePoint list, so lets search for the template which provides that functionality.

From list of templates, select “SharePoint – When a new items is created”.

Provide Site and List name

You will be promoted to provide below mandatory parameters.

Site Address – your site URL
List Name – select your list name from drop down List

once you provide details, click on next button.

Integrate Azure Function to Microsoft Flow

Add HTTP Action

Add new step to execute Azure Function from Flow, as you provide site address and list name in previous step and click next button to add new step, select “Add an Action” option and choose “HTTP” action.

select HTTP – HTTP action.

Provide HTTP Action Details

In HTTP action, you would require to give the below values.

Method – Post
URI – Azure function URL.
Headers – Not Mandatory
Body – { “name” : “”}

At the place of name you can select “Add dynamic content” and select “Created by Display Name” as input to Azure Function.

Add Email Step

Lets add one more step to send an email to the user who creates the item in list.

That email would contain the output of Azure Function. Remember we have provided “Create By DisplayName” as a input to Azure Function, which is the name of the user who creates list item. Hence expected output of the function is “Hello <<UserName>>”

Lets add one more step “Email to user”, select action “Office 365 Outlook – Send an Email”

And in the body section of email add output of HTTP Action.

click on create flow button and then save the flow.

Now we are done with all the steps, including creation of Azure Function, SharePoint List, Microsoft Flow and integration of Azure Function in Flow.

Lets now test the solution end-to-end.

Testing Solution

Add new item to DemoList.

As we have configured trigger for the flow to creation of new item to list, lets create new item to the list to see integration working.

Email

if flow configuration and email configuration is correct, after few moments you will see email in the mailbox of the user as per email step configuration.

Body of the email will be the out of Azure Function.

 

> Part 1      >> Azure     >> O365


Check Articles From Categories      Health and Parenting      Inspiring Stories      Technology      Microsoft Azure      SharePoint O365

Leave a Reply

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