domainwidedelegation.comStart free

Use casesDocuments and Drive

Remove external access from shared Drive files in bulk

Strip links and revoke external collaborators from hundreds or thousands of shared Drive files using delegated access.

Who it is forIT teams responsible for data security across shared Drives and user My Drives.
APIsDrive API
Typical scopesdrive

The problem

External sharing on Drive files accumulates over time, especially when users self-serve. Manual audits are slow and miss files, leaving sensitive data exposed.

How it works

  1. List files with external permissions using the Drive API and a delegated service account.
  2. For each file, enumerate and record all non-domain permissions.
  3. Remove any external users, groups or link-sharing permissions.
  4. Log each change for audit and possible rollback.

What changes

External access is comprehensively revoked at scale, reducing the attack surface and cleaning up legacy shares.

The trap in this one. The Drive API's permission removals are eventually consistent—removing a permission can lag, and re-listing too soon may show stale data. Processing files in rapid succession can lead to attempts to remove already-deleted permissions, which fail with 404 errors and complicate error handling. Always re-fetch permissions before acting, and expect some operations to be no-ops on retry.

Watch it explained

Bulk Share Google Drive Files Access using Google Apps Script | Aryan Irani” — Aryan Irani on YouTube. Third-party video, included because it covers this ground well. We are not affiliated with the channel.

Questions people ask

Can this process handle shared Drives and user My Drives?

Yes, but shared Drives have stricter permission models and may require additional API fields and checks. Always test on both types before running at scale.

What about files owned by suspended or departed users?

A super-admin delegated service account can still act on these files, but transfer of ownership may be needed for full cleanup.

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

Create a client folder structure the moment a deal closes

Provision a consistent Drive folder tree, seeded with templates and shared with the right people, automatically.

Generate documents from a template and real data

Produce agreements, letters and reports from a Docs template with fields filled from your systems.

Sort incoming files into the right place automatically

Watch a drop folder, work out what each file is, and file it where it belongs with a consistent name.