Found a node of type 'PrimitiveValue' when starting to read the property value; however, a node of type 'StartObject' was expected. Error while updating SharePoint file name - Power Automate
While working with SharePoint Library file name update i got following error,
"status": 400,
"message": "Found a node of type 'PrimitiveValue' when starting to read the property value; however, a node of type 'StartObject' was expected. The '__metadata' property must have an object value.\r\nclientRequestId: ",
"source": "",
"errors": [
"-1",
"Microsoft.SharePoint.Client.
]
}
This error id due to the issue while sending the metadata for the http request. We need to make sure the item body should be send as below.
{
'__metadata':
{'type':'SP.Data.Shared_x0020_DocumentItem'},
'FileLeafRef':<<Filename to be updated>>
}
Here SP.Data.Shared_x0020_DocumentItem is the term of the document library. We can get this checking the api call fo the document library.
<<SharePoint Site URL>>/_api/lists/GetByTitle('<<Document Library Name>>')/Items(7)
After updating the body, error got resolved.
Comments