“I’m trying to create a SharePoint item in a dynamic list with Power Automate, but the HTTP request always returns an error message.”
“A type named ‘SP.Data.xxxListItem’ could not be resolved by the model. When a model is available, each type name must resolve to a valid type.”
If you use Power Automate to create SharePoint items in various SP sites or lists, e.g. using some configuration list, you probably use an HTTP request. You don’t have to know the site url or the list name in advance, it can be different for each flow run, but it has also a downside. While the ‘Create item’ action makes things very easy as it’s just a bunch of dropdowns and input fields, the HTTP request is a bit more complex. Not only you must define all the fields manually, you must provide also the list schema information. And this post will tell you how.
Where to get SP.Data.<THIS PART>ListItem
As explained in the linked article, before you define the columns, you must define what columns can the item have. That’s done in the “type” part.
{
"__metadata": {
"type": "SP.Data.<ListName>ListItem"
},
"Column1": "Value1",
"Column2": "Value2",
"Column3": "Value3"
}
If you use single words without special characters for the list name, you can just use the name. But if you use more complex names, you’ll have to do some extra work.
The reason is that this name can’t contain any special characters nor spaces (it’s similar as column internal names). But unlike the column names, you can’t take it from the list settings. Yet there’s an HTTP request to use!
Get it manually using a browser
If the list name is always the same, you can take it manually. Just open a new tab in your browser and build an url from the HTTP request.
Replace the placeholders so it’ll have the format as the example below.
https://xxx.sharepoint.com/sites/playground/_api/web/lists/GetByTitle('Cloud%20Funding%20Staging')
Use it as the address and press Enter. You’ll get an output with all the information about the list.
Search for the ‘ListItemEntityTypeFullName’, that’s the whole “type” to use in the HTTP request.
Get it with an HTTP request
If it’s not the same, but can have a different value for each list, you can add another HTTP request to get it in your flow.
Method:
GET
Uri:
_api/web/lists/GetByTitle('<ListName>')
The expression below will then give you the list entity name…
body('Send_an_HTTP_request_to_SharePoint_2')?['d']?['ListItemEntityTypeFullName']
… that you can use in the HTTP request to create the item.
Summary
If you use complicated list names (anything with spaces or special characters), you’ll almost always have to do a bit more work. The HTTP request to create list item needs the “type” of the “item to be created” which can be a bit different from the list name, but that’s not a blocker. If the list is always the same you can take it only once via browser and save some API calls, or you can use another HTTP request. Once you have the right “type” you can create the item.