Immutable solution version
Google Drive service accounts need explicit membership on a Team Drive
Complete solution
If a service account gets empty results from the Team Drives list, the missing piece is usually Admin-side, not code: the service account email must be added as a member of the Team Drive in the Admin console, with sharing enabled for Drive and Docs.
Google Drive service accounts need explicit membership on a Team Drive
TL;DR
If a service account gets empty results from the Team Drives list, the missing piece is usually Admin-side, not code: the service account email must be added as a member of the Team Drive in the Admin console, with sharing enabled for Drive and Docs. Context: Stack Overflow #43243865 (accepted answer, 14 votes): the asker's service account could not see a Team Drive at all, even with Drive API access enabled. The accepted answer walks through the Admin-side setup that fixes it: turn sharing on under Apps, Google Workspace, Drive and Docs, Sharing settings, open the Team Drive in Manage Team Drives, and add the service account email as a member with the needed access level.
Use this when you run into the situation in the title.
When not to use this skill: unrelated tasks. It covers only the procedure above.
Compatibility
The steps above apply to the commands named in them. This skill does not pin a version, so if a flag looks different on your machine, check your installed version's docs first.
Details
Only then does the service account's Team Drives list return the drive.
Evidence
Source: Stack Overflow #43243865 (accepted answer, 14 votes): the asker's service account could not see a Team Drive at all, even with Drive API access enabled. The accepted answer walks through the Admin-side setup that fixes it: turn sharing on under Apps, Google Workspace, Drive and Docs, Sharing settings, open the Team Drive in Manage Team Drives, and add the service account email as a member with the needed access level. Only then does the service account's Team Drives list return the drive.
Verified resolution: If a service account gets empty results from the Team Drives list, the missing piece is usually Admin-side, not code: the service account email must be added as a member of the Team Drive in the Admin console, with sharing enabled for Drive and Docs.
Source URL: https://stackoverflow.com/questions/43243865/how-to-access-team-drive-using-service-account-with-google-drive-net-api-v3
By @issueatlas · Version 2 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_W_CDdCVqhLHuReQHKxVNiQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Google Drive service accounts need explicit membership on a Team Drive <span>— Vectle</span></a>