Create a SharePoint list in Power Automate

Create a SharePoint list using Power Automate

So your flow is creating a new SharePoint site and now you want to create a SharePoint list in the site as well. Can this be done in Power automate?

SharePoint REST API and Power Automate

In the past I wrote many posts about how to do things in SharePoint with Power Automate. so far I haven’t had a need to create SharePoint list yet.

SharePoint REST API and Power Automate flows.

In the past I tried many of the options available with the Send and HTTP request to SharePoint . I collected all these posts in the User Guide to the REST API in Power Automate.

Today I’m going to add a list to a SharePoint site.

Create a SharePoint list to a SharePoint site

First I’m going to add a simple list to the site

Within the Site address i’m selecting my site collection in SharePoint.

Within the Method I’m using POST

and the Uri points at the _api/web/lists end point.

Nothing too complicated.

The body, I’m setting to the following json:

  "AllowContentTypes": true,
  "BaseTemplate": 100,
 "ContentTypesEnabled": true,
 "Description": "My list description",
 "Title": "Test"
Create a SharePoint list

And my list is created!

Now we need to add some columns

Adding a column to a SharePoint list

The next step is to create a custom column.

First I’m going to add a column, that of the simply text type.

The body

{ '__metadata': { 'type': 'SP.Field' }, 
     'FieldTypeKind': 2, 
     'Title':'My Custom Column'

If you need to create other types of columns then please have a look at the list of column types.

Now come the important questions…

  • Should we use site columns?
  • Should we use content types?
  • Should we add this column to the content type?

For a very long time i thought that SharePoint was all about content types and site columns. In the 2007 and 2010 versions of SharePoint, we ‘proper developers’ deployed everything using SharePoint solutions.

Every project we spend a lot of time getting the content types and site columns right.

But now that content types is harder and harder to configure. Should we still bother?

When you create a new team in Microsoft Teams and a document library holds my documents is created. Things like Site Settings are multiple clicks away and hidden away under site information.

This while adding new fields to SharePoint lists has been made so much easier.

Ok, there may still be some needs for content types, e.g. if you want to connect a selective group columns to types of data, but often multiple lists or libraries could do that as well.

The other important reason for site columns for me has always been to ensure that my columns are called the same within the lists where I use the columns. With the method described in this post I can get that done.

Is it possible to create content types and use site columns with the SharePoint REST API approach?

Create a content type

It is possible to do a POST to _api/web/contenttypes and then a body like this will create you a content type:

   'Name': 'New Content Type', 
   'Description': 'New Content Type Description',
   'Group': 'Custom Content Type Group'

Retrieve Site column details

Before we can add a site column to a list we will first need to retrieve it from the site. by calling the following end point.

/_api/web/Fields/getbytitle('My Site Column')/SchemaXml

The above end point is called with a GET method resulting in the SchemaXml of the field to be returned

Create a site column as a list column

By calling /_api/web/lists/getByTitle(‘List Name’)/fields/createfieldasxml with a POST method. You can use a site column

                   'parameters': {
                       '__metadata': { 'type': 'SP.XmlSchemaFieldCreationInformation' },
                       'SchemaXml': 'columnSchema

We are now ready to use the SchemXml that we retrieved for the field.

In the flow we will need to collect the SchemXml by collecting it from the earlier REST API call.


And when we run that the flow will be successful in creating the site column on the list.

And on the SharePoint list I’ve got my column replicated.

16 thoughts on “Create a SharePoint list using Power Automate

  1. Is there any way to create the list based off a List Template that is already in the List Template Gallery?

    1. I believe that that doesn’t work. The answer is yes for the out of the box list templates but the answer is no fro the list templates that you created with save as list template. There is a problem with the list template ID if I remember that correctly. But then I never liked to use that option anyway.

  2. Hi Pieter, thank you for the great article. Once the list has been created, can Power Automate then add the list to a Sharepoint page as a list web part?

  3. Hi Pieter, thank you for the useful information. Is it possible to use a for-each loop to iterate through the columns in List A, extract the column name and type (e.g. single line of text, multiple lines of text, person, choice, etc.) for each column, and create each of the columns in the newly created List B? I could hard-code each individual column using the “Adding a column to a SharePoint list” method you described above, but this requires future hard-coding if additional columns are added to List A. Thank you in advance for your help.

    1. HI Jonathan, I would consider using an azure function running PnP PowerShell called from a flow. If this was something that you have to do on a regular basis.

      If you want to do this within the flows then you can do that too. Using the various MS Graph/REST API calls.

  4. Hi Pieter, thank you for the useful information. Is it possible to iterate through the columns in List A using a for-each loop and extract the column name and type (e.g. single line of text, choice, person, etc.), in order to add each column in list A to the newly created list B? I could hard-code each individual column using the “Adding a column to a SharePoint list” method described above, however this requires future hard-coding if any new columns were to be added to List A. Thanks in advance for any help you can provide.

  5. Hi Pieter,
    very interesting article !
    Here is a question about it:
    can I create multiple columns right away with one HTTP request or do I need a separate one for each column. If several are possible at the same time, how do I have to separate them syntactically?

    Best Regards

  6. Hi Pieter, love you articles! Super helpful.
    Is it possible in the same flow to create a list column and then to create a list item using that new column? Thanks

    1. Yes that will be possible. The creation of the list column will be another endpoint to call. A lot here will depend on the type of column etc.

      To create an item is then all quite easily done with yet another graph api or rest api end point.

  7. can any you help me, how to create associate the powerapps with list and publish the powerapps. I already exported the powerapps as zip file. Now I needs to use that zip file and associate with the list automatically once List is created. and publishthe powerapps.

    1. I assume that you are talking about SharePoint Lists.

      The best way is to include your Apps in a solution. Then use an environment variable in your solution to connect to a sharepoint list. Then export and import solutions rather than exporting apps

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: