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.InvalidClientQueryException"
  ]
}

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

Popular posts from this blog

Linksys Wireless Connection Failure

The security validation for this page is invalid. Click Back in your Web

Power Apps toPower Automate Error - The input body for trigger 'manual' of type 'Request' did not match its schema definition , the input String does not validate against the date