Use cases → Documents and Drive
Bulk restore deleted Drive files with domain delegation
Recover batches of deleted files from user Drives or shared drives using delegated access, avoiding tedious manual restores and inconsistent outcomes.
| Who it is for | Admins and delegated automation teams handling user or shared drive data loss incidents. |
|---|---|
| APIs | Drive API, Admin SDK |
| Typical scopes | drive, admin.directory.user.readonly |
The problem
When users delete files—accidentally or maliciously—restoring them one-by-one is slow and error-prone, especially across many accounts or shared drives. The Drive trash UI is not designed for bulk recovery, and the 30-day retention window adds urgency.
How it works
- Enumerate affected users or drives using Admin SDK.
- For each, impersonate the user or shared drive context via domain-wide delegation.
- List trashed files with the Drive API, filtering by deletion time or parent folder.
- Restore files by updating their 'trashed' property to false.
- Log each recovery action for auditing and track which restores failed.
What changes
Deleted files are recovered in volume without user intervention, and the process is auditable and repeatable across the organisation.
Watch it explained
“How to archive Google Workspace user to a Drive and Delete without downloading data to a computer.” — Riyas Rawther on YouTube. Third-party video, included because it covers this ground well. We are not affiliated with the channel.
Questions people ask
Can I restore files for suspended or deleted users?
You can restore files for suspended users, but for deleted users, ownership transfer or restoration must occur before account deletion. Once purged, recovery is not possible through the API.
How do I locate orphaned files after bulk restore?
Query for files with no parents after restore, then move them to a known folder. The API does not notify you of orphaning automatically.
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.