+91 – 88617 28680learning@flexmind.co

How to call an HTTP request to SharePoint in Microsoft Flow

How to call an HTTP request to SharePoint in Microsoft Flow
27
Aug

Hi readers, hope you all are doing well and enjoying Microsoft Flow & PowerApps. Today we will see “How to call an HTTP request to SharePoint in Microsoft Flow”. In this we will create and delete an item in to SharePoint custom by calling HTTP request via Microsoft Flow. You can refer link for complete basic operations using SharePoint REST endpoints. In our last blog we had seen how to create a Flow and associate it with the PowerApps. We are using the “States” custom list here to add and delete an item using HTTP request.

I will not go into the details how to create PowerApps and associate a Flow with it, because we have already seen this in our earlier blogs. if you all haven’t seen yet, please go through it for more details.

We will create two Flows, first Add Item Flow and second Delete Item Flow in order to create and delete items in SharePoint custom list. And both the flows will be associate with button trigger action of a PowerApps solution.

  1. Add Item Flow – Navigate to the edit page of MS flow and create a flow as shown in below screen shot.

Figure 1.

2. Field details used in the above screen shot are provided below.

 Site Address: <Your SharePoint Address>

Method: POST

Uri: /_api/Web/Lists/getbytitle(‘States’)/Items

Headers: Content-Type: application/json;odata=verbose and Accept: application/json;odata=verbose

Body: { __metadata:
{
type: “SP.Data.StatesListItem”
},
Title: “Test”,
District: “Test 2”
}

In body, we can pass the Title and District value as dynamic from PowerApps itself as well.

Once you are done with the above steps than try to test run the flow. In flow history you will able to see that it has been successful and created an item in to the SharePoint list as shown below.

Figure 2.

3. Now we will see how to delete an item using flow by calling an HTTP request. Create a “Delete Item Flow” as shown in below screen shot.

Figure 3.

4. Field details for delete item is given below.

Site Address: <Your SharePoint Site Address>

Method: POST

Uri: _api/web/lists/GetByTitle(‘States’)/items(@{triggerBody()[‘SendanHTTPrequesttoSharePoint_Uri’]}) –> @{triggerBody()[‘SendanHTTPrequesttoSharePoint_Uri’]} is a dynamic value to pass the item ID from PowerApps system.

Headers: X-HTTP-Method: DELETE and IF-MATCH: *

Once we are done with the above configuration then we will run the workflow. When we try to test run the workflow it will ask for the Item ID which needs to be deleted as shown in below figure.

Figure 4.

After providing the item ID, the related item will be deleted from the list. Similarly we can update and view the items as well.

Hope you guys enjoyed this article, please share and subscribe our site for more stuffs on Flow and PowerApps. You guys can also comment your real time issues on PowerApps and flow.

 

Leave a Reply