SharePointVault ~/gotchas/rest-api ⌕ Search 459 pages, error messages, scripts…Ctrl K ★ Star
M↓ README.mdM↓ validateupdatelistitem-no-new-version-depends-on-item-state.md
sharepoint-vault›gotchas›rest-api›validateupdatelistitem-no-new-version-depends-on-item-state.mdhistoryedit on GitHub
● GOTCHArest-api· 3 min read

Rewriting Created By / Modified By „without a new version“: ValidateUpdateListItem silently turns a published file into a draft or an approved one into pending

applies to: SharePoint Online (REST ValidateUpdateListItem + CSOM ProcessQuery)reviewed: 2026-11-29#rest-api#csom#versioning#content-approval#migration

After a migration or copy you often need to set Created By, Modified By, Created and Modified back to the source values. ValidateUpdateListItem with all four fields and bNewDocumentUpdate: true does that without a new version only when the item is not published or approved: in a major-only library, on folders and on drafts. A published file in a library with minor versions becomes a 1.1 draft, an approved item in a library with content approval goes back to pending – readers keep seeing the old version, while reading the values back as an admin returns the draft and looks like success. Lists can carry _ModerationStatus=0 in the same call; libraries refuse it. CSOM SystemUpdate keeps the state but writes only Created By.

Po migraci nebo kopii se často přepisuje Vytvořil, Změnil, Vytvořeno a Změněno na hodnoty ze zdroje. ValidateUpdateListItem se všemi čtyřmi poli a bNewDocumentUpdate: true to bez nové verze zvládne jen u položky, která není publikovaná ani schválená: v knihovně jen s hlavními verzemi, u složek a u konceptů. Publikovaný soubor v knihovně s vedlejšími verzemi se změní na koncept 1.1, schválená položka v knihovně se schvalováním se vrátí do stavu Čeká na schválení – čtenáři dál vidí starou verzi, a zpětné čtení pod správcem přečte koncept a tváří se jako úspěch. Seznam unese _ModerationStatus=0 ve stejném volání, knihovna ne. CSOM SystemUpdate stav zachová, ale zapíše jen Vytvořil.

Measured (SharePoint Online, 2026-11-29, throwaway lists and libraries, then recycled)

Modern site without custom scripts (EffectiveBasePermissions.Low = 4294705151 – AddAndCustomizePages missing), site collection admin. Four fields: Author and Editor = another user ([{"Key":"i:0#.f|membership|…"}]), Created and Modified = a date in the site's locale format.

Library / list, item state ValidateUpdateListItem, four fields, bNewDocumentUpdate: true
major versions only, file 1.0 ✔ all written, still 1.0
folder (also in a minor-version library) ✔ all written, still 1.0
minor versions, draft 0.1 ✔ all written, still 0.1 draft
minor versions, published 1.0 all written, but 1.1 draft (_ModerationStatus 3)
content approval (with or without minor versions), approved 1.0 all written, but pending (_ModerationStatus 2, 2.0 or 1.1)
list with content approval: four fields + _ModerationStatus=0 in one call ✔ status 0, still 1.0, all written
library: four fields + _ModerationStatus=0 in one call ✘ HTTP 500 „You cannot change moderation status and set other item properties at that same time.“ – nothing written
library with content approval: four fields, then a second call with only _ModerationStatus=0 approved again (2.0), Author, Editor, Created kept, Modified = time of the second call
minor versions, no approval: four fields + File.Publish() 2.0, but Editor = the publisher, Modified = now
minor versions, no approval: _Level=1 in the same call still a 1.1 draft
CSOM SetFieldValue ×4 + SystemUpdate() (user field as FieldUserValue {c956ab54-16bd-4c18-89d2-996f57282a6f} with LookupId) version and state unchanged, but only Author is written – Editor, Created, Modified are ignored
CSOM UpdateOverwriteVersion() same as ValidateUpdateListItem (1.1 draft / pending)

„Additions to this Web site have been blocked“ did not appear in any of these cases on the no-script site (compare update-document-metadata-without-a-new-version.md, where custom columns on a PDF failed that way).

Rule

  1. Before the write, read the item state (OData__ModerationStatus, OData__UIVersionString, FSObjType) and the library settings (EnableModeration, EnableMinorVersions), and pick the route from the table.
  2. After the write, check that the state did not change – reading the values back as an admin reads the draft and passes.
  3. List with content approval → send _ModerationStatus=0 in the same call. Library with content approval → two calls, and tell the user that Modified is now the time of the fix.
  4. Published file in a minor-version library without approval: the full four fields cannot be written without leaving a draft. Author via CSOM SystemUpdate; report Editor as not replaceable.
  5. A 200 from ValidateUpdateListItem means nothing – check HasException per field; a 200 from ProcessQuery can carry ErrorInfo.
Was this helpful?ask or add your experience on GitHub →
Saved you an hour? A star on GitHub helps other SharePoint people find the vault.★ Star on GitHub
last reviewed: 2026-11-29last updated: 2026-11-29historyedit on GitHubview source