Working with SharePoint List using SharePoint Send HTTP Request action in Power Automate

The SharePoint Connector in Power Automate provides many actions with which you can create items, get items, delete items etc. In some scenarios the out of box actions cannot not handle your requirements (e.g. You cannot create a SharePoint List etc.), or the action you are looking for is not yet available.

In Power Automate, the SharePoint Send HTTP Request action lets you construct and execute SharePoint REST API which helps you handle scenarios the out of box actions do not handle your requirements.

In this post, we’ll work with a SharePoint List using The SharePoint Send HTTP Request action in Power Automate

  • Create a SharePoint Custom List using SharePoint Send HTTP Request flow action in Power Automate
  • Add columns to SharePoint List using SharePoint Send HTTP Request flow action in Power Automate.
  • Add columns to the Default view using SharePoint Send HTTP Request flow action in Power Automate.
  • Add items to SharePoint List using SharePoint Send HTTP Request flow action in Power Automate.

If you are new to SharePoint Online REST API – I would recommend that you Get yourself familiar with SharePoint REST API.

High level overview of SharePoint REST API

To access SharePoint resources using REST, construct a RESTful HTTP request by using the OData standard. For example –

On the below example(screenshot), we can get the items from SharePoint List.

Note -If you execute a GET request, you generally want to parse the response. The default response is JSON, making execution simpler. For more details see the blog How to use Parse JSON action in Power Automate

Now that we know the basics, let’s start using SharePoint REST API with Power Automate

If you prefer to watch the following steps being completed instead of reading through them, please just view the video below:

Create a SharePoint Custom List using SharePoint Send HTTP Request flow action in Power Automate

Using out of the box SharePoint Power Automate actions you cannot create List. In this particular scenario, The SharePoint REST API comes to our rescue.

Lets add the ‘Send an HTTP Request to SharePoint’ action to your flow designer canvas and configure it with reference to the screenshot below:

  • Site Address: Provide the Site URL.
  • Method: POST ( we want to make changes in SharePoint)
  • URI: _api/web/lists
  • Headers:
    • content-type: application/json;odata=nometadata
    • accept: application/json;odata= nometadata
  • Body:
    • BaseTemplate: 100(Custom list – A basic list that can be adapted for multiple purposes.) – The following article describes standard list template types used for storing data in a site.
    • Description: Decryption of the list.
    • Title: Name of the list
{
  "BaseTemplate": 100,
 "Description": "My list description",
 "Title": "Clavin Demo HTTP"
}

Add columns to a SharePoint List using SharePoint ‘Send an HTTP Request to SharePoint’ flow action in Power Automate

Using out of the box SharePoint Action you cannot add Columns to an existing List. Again, in this particular scenario the SharePoint REST API comes to our rescue.

Add the ‘Send an HTTP Request to SharePoint’ action to your flow designer canvas and configure it with reference to the screenshot below:

  • Site Address: Provide the Site URL where your list resides.
  • Method: POST ( we want to make changes in SharePoint)
  • URI: _api/web/lists/getbytitle(‘<your list name>’)/fields
  • Headers:
    • content-type: application/json;odata=nometadata
    • accept: application/json;odata= nometadata
  • Body:
    • ‘__metadata’: { ‘type’: ‘SP.Field’ } : Represents a field in a list.
    • FieldTypeKind: 2(Text) The article describes standard list template types used for storing data in a site.
    • Title: Name of the Field.
{ 
'__metadata': { 'type': 'SP.Field' }, 
     'FieldTypeKind': 2, 
     'Title':'Clavin Text Column'
}

Add columns to the Default view using SharePoint ‘Send an HTTP Request to SharePoint’ flow action in Power Automate

Another scenario in which the out of the box action fall short. Using out of the box SharePoint Action you cannot Add Columns to a View .

Add the ‘Send an HTTP Request to SharePoint’ action to your flow designer canvas and configure it with reference to the screenshot below and add the columns to the View.

  • Site Address: Provide the Site URL where your list resides.
  • Method: POST ( we want to make changes in SharePoint)
  • URI: _api/web/lists/GetByTitle(‘<your list name>)/Views/GetByTitle(<Name of the View>’)/addViewField(‘Name of the Column’)
  • Headers:
    • content-type: application/json;odata=nometadata
    • accept: application/json;odata= nometadata

Add items to SharePoint List using SharePoint ‘Send an HTTP Request to SharePoint’ flow action in Power Automate

In Power Automate, we have an out of box action called Create Item to create new list item in SharePoint list, but creating new List Item using Rest API call from Power Automate gives you more control and flexibility.

Add the ‘Send an HTTP Request to SharePoint’ action to your flow designer canvas and configure it with reference to the screenshot below and add the columns to the View.

  • Site Address: Provide the Site URL where your list resides.
  • Method: POST ( we want to make changes in SharePoint)
  • URI: _api/web/lists/GetByTitle(‘<your list name>)/Views/GetByTitle(<Name of the View>’)/addViewField(‘Name of the Column’)
  • Headers:
    • content-type: application/json;odata=nometadata
    • accept: application/json;odata= nometadata

  • Site Address: Provide the Site URL where your list resides.
  • Method: POST ( we want to make changes in SharePoint)
  • URI: _api/web/lists/getbytitle(‘<your list name>’)/fields
  • Headers:
    • content-type: application/json;odata=nometadata
    • accept: application/json;odata= nometadata
  • Body:
    • Name of Column“: “value”
{
"Title":"Mr",
"Clavin_x0020_Text_x0020_Column":"Sample Text for demo"
}

Final screenshot for SharePoint List –

Subscribe to this blog for the latest updates about SharePoint Online, Azure, PowerShell, Power Automate (Microsoft Flow), Power Apps and document conversion and manipulation using The PDF Converter.

2 thoughts on “Working with SharePoint List using SharePoint Send HTTP Request action in Power Automate

  1. Clavin- great tutorial and accompanying video. But what if we want to create multiple columns? I imagine it could be done using dynamic data from an Excel spreadsheet and a For Each action (which may in fact be more practical)… but is it still possible to do this with a single HTTP Post using hardcoded JSON in the body?

    Like

Leave a comment