Sharepoint API update a file throws Specified value is not supported for the serverRelativeUrl parameter
-
08-02-2021 - |
Question
I am trying to update a file in sharepoint using API. I am trying in POSTMAN only. Below are the url and headers which i send. I am using PUT Method. url:
https://groupname.sharepoint.com/sites/MMSN/_api/web/GetFileByServerRelativeUrl('Shared Documents/DB_Folder')/Files('db_sample.json')/$value
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSU
X-HTTP-Method: PUT
Error:
<m:error
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code>-2147024809, System.ArgumentException</m:code>
<m:message xml:lang="en-US">serverRelativeUrl
Parameter name: Specified value is not supported for the serverRelativeUrl parameter.</m:message>
</m:error>
Is my relative url and headers are valid ?
Solution
The parameter of GetFileByServerRelativeUrl method should be the server-relative URL for the file. While you set a folder path.
Reference:
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange