Content approval with drafts visible to approvers: ApproveItems alone shows no drafts — the approver also needs EditListItems
In a library with minor versions, content approval and “drafts visible to users who can approve”, a custom role of Read + Approve Items sees no drafts and no pending files, so Approve returns 404 (“file does not exist”). SharePoint does not add the dependency for you when you create the role over REST. Give approvers Read + Edit Items + Approve Items (the built-in Design level carries both bits; Edit has no Approve Items). A member with Edit who is not the author sees only the last approved major — so this configuration does hide drafts from editors, unlike “drafts visible to users who can edit”.
V knihovně s vedlejšími verzemi, schvalováním obsahu a „koncepty vidí ti, kdo smí schvalovat“ vlastní role Čtení + Schvalovat položky nevidí koncepty ani čekající soubory a Approve vrátí 404. SharePoint závislost při založení role přes REST nedoplní. Schvalovatel potřebuje Čtení + Upravovat položky + Schvalovat položky (vestavěná úroveň Návrh má oba bity, Úpravy Schvalovat nemají). Člen s Úpravami, který není autor, vidí jen poslední schválenou hlavní verzi – tahle konfigurace tedy koncepty před editory skryje, na rozdíl od „koncepty vidí ti, kdo smí upravovat“.
Measured (one library, two accounts, A/B per row)
Files: a.pdf = approved 1.0 + draft 1.1 by another user; b.pdf = draft 0.1 only. The test account reads through /items, /$value and the direct file URL.
| Library setting | Test account role | What it sees |
|---|---|---|
| Minor versions, drafts visible to readers | Read | everything, drafts included |
| Drafts visible to authors (users who can edit) | Read | a.pdf at 1.0 only; b.pdf 404 |
| same | Edit | all drafts |
| + content approval, drafts visible to approvers | Edit (not author) | a.pdf at 1.0 only; b.pdf 404 |
| same | Edit | own upload + Publish → status Pending, label stays 0.1; Approve → 403 |
| same | Read + ApproveItems (mask 138612849) |
no drafts, no pending; Approve → 404 |
| same | Read + EditListItems + ApproveItems (138612853) |
drafts and pending visible; Approve → 200, 0.1 becomes 1.0 |
Side observations:
- Overwriting an approved file with Edit Items in a moderated library creates a new draft (
1.2); readers keep getting1.0until someone approves it. movetointo a subfolder keeps the version history, the current draft, the moderation status andUniqueId.- Turning content approval on in a library that already has files (
EnableModeration: true,DraftVersionVisibility: 2): every published major version gets_ModerationStatus = 0(Approved) right away and stays visible to readers. A draft (0.1) and a minor version on top of a major (1.1) stay at status 3 (Draft); readers then get1.0for that file. Nothing moves to Pending and no published file disappears. Only drafts that readers could see before get hidden.
Second trap: updating a role definition's mask
POST /_api/web/roledefinitions(<id>) X-HTTP-Method: MERGE
{ "BasePermissions": { "Low": "...", "High": "176" } } → 204
The response is 204, but GetUserEffectivePermissions still shows the old mask. Do not trust the 204: create a new role definition with the mask you need, move the assignments to it, then delete the old one.
Rule
- When an approver must see drafts, check both bits (
EditListItems0x4 andApproveItems0x10) inGetUserEffectivePermissionsfor each approver principal. An audit that checks onlyApproveItemsreports a working setup that cannot approve. - “Drafts visible to users who can edit” does not hide drafts from members with Edit. Use content approval with “drafts visible to approvers”.
- After changing a role definition, measure the effective permissions instead of trusting the status code.