I am trying to update the properties of a OneDrive item using SharePoint REST API.
OneDrive item web URL:
https://vx13-my.sharepoint.com/personal/alexw_vx13_onmicrosoft_com/Documents/SrcDir/File-To-Update.txt
Mainly looking to updating following fields: Author, Created_x0020_By, Editor, Modified_x0020_By, Modified, Created
I tried using Graph API:
Request:
Method: PATCH |
URL: https://graph.microsoft.com/v1.0/sites/vx13-my.sharepoint.com,eab581b1-a945-4d23-9c8e-ec67bb74a42d,32fa1468-54b6-40d6-abbd-f775c4c3932b/drives/b!sYG16kWpI02cjuxnu3SkLWgU-jK2VNZAq733dcTDkyvIAAMdpSy_Sryiw8ARQ8Gv/root:/SrcDir/File-To-Update.txt:/listItem/fields |
Header:
Content-Type: application/json |
Accept: application/json;odata=verbose |
Body:
{
"Created": "2019-02-01 10:25 AM",
"Modified": "2020-01-27 11:25 AM",
"Modified_x0020_By": "3",
"Created_x0020_By": "3",
"Author": "Alex Wilber",
"Editor": "Alex Wilber"
}
It is giving failure response as:
{"code": "accessDenied", "message": "Field 'Created' is read-only"}
Through CSOM API using ValidateUpdateListItem()
its working & successfully updating the property fields of OneDrive items.
But is there any way to update property fields of OneDrive item through REST API?