Create SharePoint List View Using REST API in Power Automate

Recently, I worked on a project where I needed to create the same custom view in multiple SharePoint lists. Doing it manually each time was time-consuming and not ideal, so I decided to automate the process using Power Automate and the SharePoint REST API.

In this tutorial, I will show you how to create custom SharePoint list views, whether filtering by choice columns, applying AND/OR conditions, or sorting data.

Create a View in SharePoint List Using REST API

To create a view in a SharePoint list using the REST API, we will use the Send an HTTP request to SharePoint action in Power Automate. This action allows us to communicate directly with SharePoint and perform actions, such as creating custom views, by sending the appropriate REST API call.

SharePoint uses an object called SP.View to define and manage views on a list. This object allows us to set options such as the view name, filters, columns to display, and more.

For this tutorial, I will use a SharePoint list called Support Tickets. The screenshot below shows its structure.

create SharePoint list view using Power Automate

Let’s see how to create the view in SharePoint List using REST API:

SharePoint List View Using a Choice Column with a Filter

Here, I need to create a view that filters list items based on a specific value selected in a Choice column (Priority equals High).

  1. Go to Power Automate and create a new instant cloud flow by manually triggering a flow trigger.
  2. Add a Send an HTTP Request to SharePoint action and provide the below parameters:
    • Site Address: Select the SharePoint site address.
    • Method: Use the POST method to create the view in the SharePoint list.
    • Uri: Provide the URI as below, required to do the REST API call:
_api/web/lists/GetByTitle('List Name')/Views
  1. Headers: Provide the headers as shown below, as they are required to make the REST API call.
{
  "Accept": "application/json;odata=verbose",
  "Content-Type": "application/json;odata=verbose"
}
  1. Body: Provide the below json code:
{
   '__metadata':{

    'type': 'SP.View'
  },
   'Title':'High Priority',
   'ViewQuery':'<Where><Eq><FieldRef Name="Priority" /><Value    Type="Text">High</Value></Eq></Where>  '
}  
  • __metadata: This part tells SharePoint what type of object is being referenced—in this case, it’s a “view.”
  • Title: This is the name of the view. In this example, the view is named “High Priority.”
  • ViewQuery: This is where the actual filtering happens. It defines a query that filters items based on their “Priority” field. The condition in the query is:
    • <Where>: This is the start of the filtering condition.
    • <Eq>: This means “equals.” So it’s checking if the field meets a specific value.
    • <FieldRef Name=”Priority” />: This refers to the “Priority” field in the SharePoint list.
    • <Value Type=”Text”>High</Value>: This specifies that the value being checked for in the “Priority” field is “High.”
SharePoint List View Using a Choice Column with a Filter
  1. Then, save the flow and run it manually.
  2. Once the flow runs successfully, navigate to the SharePoint list and view the newly created list. Then, click the list view to see tasks with a high Priority.
Power Automate SharePoint List View Using a Choice Column with a Filter

This way, you can create a view in SharePoint List using the REST API in Power Automate.

Create Custom List Views with Multiple Conditions Using REST API

This example shows how to create a SharePoint list view based on multiple conditions using the REST API.

Here, I will cover two different Conditions, which are the AND condition and the OR condition:

List Views With AND Condition

Here, I will create a view that displays only tickets with an ‘Open’ status and a ‘Low’ priority.

  1. Create an instant cloud flow with a trigger: Manually trigger a flow.
  2. Then, send an HTTP request and provide the following required parameters to SharePoint to create the view:
    • Site Address: Select the SharePoint Site Address.
    • Method: Select POST as the method.
    • Uri: Provide the below URI:
_api/web/lists/GetByTitle('List Name')/Views
  1. Headers: Click on the Switch to text mode button to input the json. Copy and paste the code below in the Headers section.
{
  "Accept": "application/json;odata=verbose",
  "Content-Type": "application/json;odata=verbose"
}
  1. Body: Provide the below json code to create the view.
{
   '__metadata':{
    'type': 'SP.View'
  },
   'Title':'Open status and  Low priority',
   'ViewQuery':'<Where><And><Eq><FieldRef Name="Status" /><Value    Type="Text">Open</Value></Eq><Eq><FieldRef Name="Priority" /><Value    Type="Text">Low</Value></Eq></And></Where>  '
}
How to Create Sharepoint List View Filters in Power Autoamte
  1. Now, run the flow. After the flow runs successfully, you can see the result below when you go to the list and click the “Open status and Low priority” view.
How to filter list view based on multiple values in another in Power Automate

If you want to add more conditions, you can extend the <And></And> section in the ViewQuery. For example, if you also want to filter by “Category” being “Support”, you can add another <Eq></Eq> condition inside the <And></And> like this:

<Where>
   <And>
         <Eq><FieldRef Name="Status" /><Value Type="Text">Open</Value></Eq>
         <Eq><FieldRef Name="Priority" /><Value Type="Text">Low</Value></Eq>
      <Eq><FieldRef Name="Category" /><Value Type="Text">Support</Value></Eq>
   </And>
</Where>

This way, you can add as many conditions as needed to filter your SharePoint list.

List Views With OR Condition

In this example, we will use Power Automate and the SharePoint REST API to create a new list view in the Support Tickets list that shows only items with a Status equal to Open or Resolved.

So let’s get to it!

  1. Open the Power Automate Home page and choose Instant cloud flow with trigger Manually trigger a flow.
  2. To create the view using Power Automate, use the Send an HTTP request to SharePoint action with the following parameters:
    • Site Address: Your SharePoint site URL
    • Method: POST
    • Uri:
_api/web/lists/getbytitle('Support Tickets')/views
  1. Headers:
{
  "Accept": "application/json;odata=verbose",
  "Content-Type": "application/json;odata=verbose"
}
  1. Body:
{
   '__metadata':{
    'type': 'SP.View'
  },
   'Title':'Open or Resolved',
   'ViewQuery':'<Where><Or><Eq><FieldRef Name="Status" /><Value    Type="Text">Open</Value></Eq><Eq><FieldRef Name="Status" /><Value    Type="Text">Resolved</Value></Eq></Or></Where>  '
}
Create Custom List Views with Multiple Conditions Using REST API in Power Autoamte
  1. Then, save the flow and run it manually. Once the flow runs successfully, you can navigate to your Support Tickets list and view a new section named Open or Resolved. This view displays only items with the Status Open or Resolved.
  2. If you are using the same flow, you will see a response similar to the screenshots below, indicating that the HTTP request ran successfully and the view was created.
Power Automate Create Custom List Views with Multiple Conditions Using REST API

List View with Sort List Items in Ascending or Descending Order

In the previous examples, we saw how to create a list based on filters. Now, I’ll show you how to create a list view in ascending or descending order.

For example, let’s say you want to create a view in the Support Tickets SharePoint list that sorts the items by the Ticket ID column in descending order.

Now follow the steps below:

  1. Go to Power Automate -> Click Create -> choose Instant cloud flow -> Give your flow a name -> Choose Manually trigger a flow -> Click Create.
  2. Add the “Send an HTTP request to SharePoint” action and use the following details:
    • Site Address: Your SharePoint site (where the Support Tickets list exists)
    • Method: POST
    • URI:
_api/web/lists/getbytitle('Support Tickets')/views
  1. Headers:
{
  "Accept": "application/json;odata=verbose",
  "Content-Type": "application/json;odata=verbose"
}
  1. Body:
{
  "__metadata": {
    "type": "SP.View"
  },
  "Title": "Sorted",
  "ViewQuery": "<OrderBy><FieldRef Name='TicketID' Ascending='FALSE' /></OrderBy>"
}
List View with Sort List Items in Ascending or Descending Order  in Power Automate
  1. Click Save and Click Run. Once the flow runs successfully, a new view named Sorted will be created in your Support Tickets list. It will display the items sorted by TicketID in descending order (from highest to lowest).
Create SharePoint List View using REST API in Power Automate

In the same way, you can sort the list items in ascending order by changing just one part in the body.

"ViewQuery": "<OrderBy><FieldRef Name='TicketID' Ascending='TRUE' /></OrderBy>"

This will create a view where the items are sorted by TicketID in ascending order (from lowest to highest).

You may also like:

Power Apps functions free pdf

30 Power Apps Functions

This free guide walks you through the 30 most-used Power Apps functions with real business examples, exact syntax, and results you can see.

Download User registration canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App