Use cases → Documents and Drive
Transfer Drive folder ownership between users
Reassign entire Drive folder hierarchies to a new owner, retaining sharing and structure, without manual intervention.
| Who it is for | IT administrators consolidating user accounts or managing offboarding at scale. |
|---|---|
| APIs | Drive API, Admin SDK |
| Typical scopes | drive, admin.directory.user |
The problem
Manual transfer of Drive folders is laborious, error-prone, and often misses nested files or shared permissions. Automating via delegated service account avoids missed content, but brings its own complications.
How it works
- Enumerate all files and subfolders beneath the target folder using the Drive API, following each child recursively.
- Invoke the Drive API's 'files.update' with the 'owner' field for each file and folder, specifying the new user.
- Update sharing permissions if required, to maintain access for collaborators.
- Log all changes and retry any item that fails due to transient errors.
What changes
The folder and all its contents appear under the new owner's Drive, with structure and permissions preserved.
Watch it explained
“Guidelines for configuring Google Drive API key with Documents Sharing Plugin - Google Docs Viewer” — SocialAppsTech on YouTube. Third-party video, included because it covers this ground well. We are not affiliated with the channel.
Questions people ask
Does this preserve sharing settings?
Generally yes, but files shared 'with link' that were visible due to the old owner's organisational context may become inaccessible if the new owner is external or under different restrictions.
How long does the transfer take to reflect?
Propagation is near-instant for small folders, but large hierarchies can take minutes to hours to appear in the new owner's Drive, especially if items are being indexed or permissions recalculated.
Want this built?
This is a pattern we run in production. We will set up the delegation and build this on top of it — $500 per hour, most of it working the same day.
Talk to us Or read the setup guideRelated use cases
Rotate Drive access for external collaborators via automation
Regularly expire and re-grant Drive file access for external users without manual intervention or missed revocations.
Enforce Drive storage quotas on a schedule
Identify and act on users who exceed Drive storage limits by scanning usage periodically and triggering clean-up or escalation.
Migrate Drive data between teams with delegated access
Move shared Drive content for a whole team between organisational units or domains, preserving permissions and structure with a delegated service account.