domainwidedelegation.comStart free

Use casesDocuments and Drive

Automate migration of user Drive and mail with domain delegation

Bulk-migrate Drive files and Gmail messages between accounts or domains without user involvement, handling real-world volume and edge cases.

Who it is forIT and automation teams migrating data at scale for onboarding, offboarding, or domain consolidation.
APIsDrive API, Gmail API
Typical scopesdrive, gmail.readonly, gmail.insert

The problem

Manual data migration is slow, error-prone and unscalable, especially when moving hundreds of user accounts or entire departments. Users may not have time or knowledge to handle exports, and leaving data behind can break business continuity.

How it works

  1. Grant domain-wide delegation to a service account with the necessary scopes.
  2. Impersonate each source user in turn to enumerate and export their Drive files and Gmail messages.
  3. Impersonate the destination user to import content, preserving metadata where possible.
  4. Track processed items to avoid duplicates and ensure idempotency.
  5. Log and retry failures, especially for large attachments and shared files.

What changes

Large-scale data moves complete without user action, preserving ownership and audit trails, and reducing downtime during user transitions.

The trap in this one. Migrating Drive files that are shared with external users or owned by a shared drive can silently skip those items: the Drive API's export and copy endpoints do not always copy sharing settings or can outright refuse to copy files where the destination lacks access. These skips are not flagged as hard errors and only appear if you audit the resulting file tree—so missing data can go unnoticed until users complain.

Watch it explained

How to Migrate Users in 24 Hours to Google Workspace ?” — Google Workspace Admin on YouTube. Third-party video, included because it covers this ground well. We are not affiliated with the channel.

Questions people ask

Can you preserve original timestamps and folder structure?

Timestamps can be preserved on Gmail messages using gmail.insert with appropriate headers, but Drive file creation dates cannot be set via the API. Folder structures require careful mapping and recreation on the destination.

How do you handle mail labels and threading?

Labels can be mapped and recreated, but system labels may not transfer directly. Threading is not preserved unless you carefully insert messages in order with correct headers.

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 guide

Related use cases

Send access alerts for sensitive Drive files in context

Alert the right people when a sensitive file is accessed, including file details and triggering context, using a delegated service account.

Notify the owner when a document is untouched for 90 days

Alert document owners before files are forgotten by tracking Drive activity and sending targeted notifications when a document hasn't been opened in 90 days.

Route inbound CVs into a hiring pipeline folder

Automatically collect candidate CVs from email and place them in a shared Drive folder for the hiring team.