A type named 'SP.Data.TestListListItem' could not be resolved by the model. When a model is available, each type name must resolve to a valid type.
Scenario:
Trying to update a SharePoint list item using Send an HTTP request to Sharepoint action in Power Automate.
This is an exception case, and i am writing it only to save someone's else time.
Normally we can use Power Automate to GET, POST, PATCH & DELETE sharepoint list items.
There are standard syntax, you need to follow to do it.
The above title is an exception when your list name has a space when you create it. But when you delete that space later your Send HTTP request to SharePoint starts giving an error.
To be more clear i had a list called Master_Timesheet. And all i was doing was calling a flow from a Power App button and passing the listitem ID as parameter to the flow
Something like this.
FlowName.Run(ThisItem.ID)
But to my surprise i was getting the below error.
A type named 'SP.Data.Master_TimesheetListItem' could not be resolved by the model. When a model is available, each type name must resolve to a valid type.
Initially i thought that i must have messed up with the Uri
So i hardcoded the ID, but no luck.
I checked my listname and the url says
https://YourServerName/Lists/Master_TimeSheet/All%20Items.aspx
So i tried getting the xml for the item by using the below link
https://YourServerName/_api/web/lists/getbytitle('Master_TimeSheet')/items(6)
and it returned me the xml.
This was really confusing as the flow was still showing me error.
Then on further investigation i found something very surprising.
https://YourServerName/_api/lists/getbytitle('Master_TimeSheet')?$select=ListItemEntityTypeFullName
This i read in a blog if the list/ library name has changed after creation.
The XML i got returned was
<?xml version="1.0" encoding="utf-8"?><entry xml:base="https://YourServerName/_api/" xmlns="http://www.w3.org/2005/Atom"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:etag=""141"">
<id>https://YourServerName/_api/Web/Lists(guid'ea980193-53b6-4357-94b8-00098636ceef')</id>
<category term="SP.List" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link rel="edit" href="Web/Lists(guid'ea980193-53b6-4357-94b8-00098636ceef')" /><title />
<updated>2021-05-03T02:31:58Z</updated><author><name /></author>
<content type="application/xml"><m:properties><d:ListItemEntityTypeFullName>SP.Data.Master_x005f_TimeSheetListItem</d:ListItemEntityTypeFullName>
</m:properties></content></entry>
In the above xml what i found strange was SP.Data.YourListNameListItem was different to what i have been using in my flows.
i was using SP.Data.Master_TimeSheetListItem instead of SP.Data.Master_x005f_TimeSheetListItem
As soon i made the above change in the body of my Send an HTTP request to SharePoint action the flow succeeded.
Also, a bonus is SP.Data is YourLibraryItem for library and
SP.Data.YourListListITem if its a custom list.
Comments
Post a Comment