Repository navigation
feat(offboarding): copy a leaver's OneDrive to recipients before licences are removed - #1281
Open
redanthrax wants to merge 1 commit into
Open
redanthrax wants to merge 1 commit into
redanthrax wants to merge 1 commit into
Conversation
redanthrax
force-pushed
the
6-onedrive-copy-to-user
branch
from
November 14, 2026 18:21
d78f0b5 to
483081f
Compare
redanthrax
marked this pull request as ready for review
November 14, 2026 18:34
redanthrax
marked this pull request as draft
November 14, 2026 22:20
redanthrax
force-pushed
the
6-onedrive-copy-to-user
branch
from
November 14, 2026 23:21
483081f to
9b76999
Compare
redanthrax
marked this pull request as ready for review
November 14, 2026 23:23
…nces are removed Copies a leaver's OneDrive root into a /<leaver UPN> folder at the root of one or more recipients' OneDrives, and holds licence removal until the copy is confirmed complete. - ExecOneDriveCopyToUser (start) and ListOneDriveCopyToUser (status), with new permissions Identity.OneDrive.ReadWrite / Identity.OneDrive.Read so an API client can be given only this. - SharePoint CreateCopyJobs for the root items (SharePoint may bundle several items into one job), KeepBoth on name conflicts (nothing overwritten), version history optional. The leaver's whole OneDrive is counted first (Graph delta) for file and byte totals. Limits: 1-1000 root items, 100,000 items in total, up to 10 recipients. - Refused before anything is written: leaver not disabled, leaver or recipient without OneDrive, recipient unlicensed, guest or other-organisation recipient, other tenant, not enough free space, or a recipient with a file named like the copy folder. - Status per recipient (Queued / InProgress / Completed / Failed) with items, bytes and errors. SharePoint is polled at most once per 60 s per operation (ETag-claimed), with a capped, rotating set of jobs per call. Completed needs every job confirmed by SharePoint with no errors (errors accumulate across checks) and at least as many files copied as were counted; fewer is Failed. More files, or a byte total that differs, completes with a warning. - Offboarding wizard option "Copy OneDrive to user(s)" (requires Disable sign in). The copy runs before licence removal; licences are removed only once that run's own copy completes, via a 30-minute follow-up task, and are kept on failure, a missing copy or after 13 days. The copy id is kept with the offboarding task so re-running only the licence step finds it; the copy step waits briefly for the sign-in block to show before refusing; copy + Delete user is refused. - Copy records are keyed by the tenant's id, so status works with the domain or the id. - Offboarding without the option is unchanged; library copy helpers gain optional -TableName and -IgnoreVersionHistory with the old defaults. - Pester tests for the endpoints, core functions, offboarding step and licence gate; openapi.json.
redanthrax
force-pushed
the
6-onedrive-copy-to-user
branch
from
November 14, 2026 23:37
9b76999 to
095d154
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Copies a leaver's OneDrive to one or more recipients during offboarding, and only removes the leaver's licences once the copy is confirmed. Offboarding without the new option is unchanged.
What it does
/<leaver UPN>/folder in each recipient's OneDrive. Name clashes keep both files, so nothing is overwritten.POST ExecOneDriveCopyToUser{tenantFilter, leaver, recipients[], includeVersionHistory?}Identity.OneDrive.ReadWriteGET ListOneDriveCopyToUser?tenantFilter=&OperationId=Identity.OneDrive.ReadChecks
A copy is refused (400) if:
How it works
CreateCopyJobs. SharePoint groups the items into jobs itself.delta). A recipient is only Completed when every job finished without errors and at least that many files were copied. Fewer files is Failed. More files, or a byte total that differs, completes with a warning.Testing
notes1.txt). The licence was removed after the copy completed..docx,.xlsxand.pptxfiles with document properties and for a OneNote notebook (12/12 files, bytes identical). Status polling works with the tenant's domain or id.