In this Power Automate article, we will see how to fix the error The property ‘__metadata’ does not exist on type ‘SP.List’.
Recently, when I want to create a SharePoint List from the rest API using Power Automate flow. I got an error like The property ‘__metadata’ does not exist on type ‘SP.List in a Send an HTTP request to SharePoint action as highlighted below:
Now we will discuss the solution and how to solve the error. The property ‘__metadata’ does not exist on type ‘SP.List.
The property ‘__metadata’ does not exist on type ‘SP.List’
Here we are going to create a SharePoint list using Power Automate flow.
- Create an instant cloud flow that triggers manually. Then Add an action ‘Send an HTTP request to SharePoint‘ from action triggers and provide the SharePoint site address.
- Method- POST
- Uri- /_api/web/lists
- Headers-
- Accept – application/json;odata=verbose
- content-type – application/json;
- Body: Add the below JSON code to create a new list using Rest API and dynamically pass the JSON content values for Title, Description, and Base Template.
{
"__metadata": {
"type": "SP.List"
},
"AllowContentTypes": true,
"BaseTemplate": 100,
"ContentTypesEnabled": true,
"Description": "My list description",
"Title": "Test"
}
Save and run the flow by selecting the run flow option and it throws an error like below, and the SharePoint List is not created in the SharePoint site.
- Now we are getting an error: The property ‘__metadata’ does not exist on type ‘SP.List’. we will see how to fix it.
- It is because when we set the ContentType request header in Send an HTTP request to SharePoint action, instead of “application/json” we have to pass the values as “application/json;odata=verbose” as highlighted below:
The correct content type is
"application/json;odata=verbose"
Save and run the flow by selecting the run flow option, we can see our flow ran successfully and the SharePoint List was also created on the SharePoint site.
Output:
In this Power Automate article, we saw how to fix the error: The property ‘__metadata’ does not exist on type ‘SP.List’ in Power Automate.
You may also like:
- Create SharePoint lists from JSON using Power Automate
- How to create an array from a string using Power Automate?
- How to convert base64 to an image file in Power Automate?
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.