-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
SharePoint REST API
Developer environment
Windows
What browser(s) / client(s) have you tested
- 💥 Internet Explorer
- 💥 Microsoft Edge
- 💥 Google Chrome
- 💥 FireFox
- 💥 Safari
- mobile (iOS/iPadOS)
- mobile (Android)
- not applicable
- other (enter in the "Additional environment details" area below)
Additional environment details
Just plain HTTP requests.
Describe the bug / error
Since last week we've been getting API errors when calling 'ValidateUpdateListItem' right after creating a Document Set.
"The file Documents/Testdocumentset has been modified by i:0#.f|membership|john.doe@contoso.com on 16 Oct 2023 01:13:43 -07:00"
While this code has been working fine for months.
💡 Solution
When setting the second parameter (bNewDocumentUpdate) of ValidateUpdateListItem to 'true', things started working again.
Description of the parameter: "Set to 'true' if the list item is a document being updated after upload; otherwise 'false'."
A Document Set is not a document, but it is a file system object just like a document is. Maybe someone over at Microsoft flipped a switch and consolidated behavior between folders and files.
Steps to reproduce
What we do is
- create a document set using the listdata.svc endpoint.
- And directly after that update the metadata of the docset using ValidateUpdateListItem
The following HTTP request creates the document set:
POST /sites/sales/_vti_bin/listdata.svc/Documents
content-type: application/json;odata=verbose
accept: application/json;odata=verbose
slug: /sites/sales/Documents/TestDocumentSet|0x0120D52000274979C6547745BF900A22116300BF9F00AA4B5C308CC74698ABBB127D86F6F8A6
{"Title":"TestDocumentSet","Path":"/sites/sales"}
The following HTTP request should update the Metadata:
POST https://contoso.sharepoint.com/sites/sales/_api/web/lists/getByTitle('Documents')/items(1234)/ValidateUpdateListItem
content-type: application/json;odata=verbose
accept: application/json;odata=verbose
{ "formValues": [ { "FieldName": "ContentTypeId", "FieldValue": "0x0120D52000274979C6547745BF900A22116300BF9F00AA4B5C308CC74698ABBB127D86F6F8A6" }, { "FieldName": "FileLeafRef", "FieldValue": "TestDocumentSet" }, { "FieldName": "FieldNameX", "FieldValue": "Some value" }, { "FieldName": "FieldNameY", "FieldValue": "Some value" } ] }
Expected behavior
I'd expect the metadata update to work as expected. It did for months. Past friday 13 october, it started crashing.
Including the bNewDocumentUpdate
in the request body (or retrying the execution) fixed it.