does know configurations should done grant google service account access team drive created?
the idea use service account in .net backend application uploading/downloading files to/from team drive shared among company employees. example, company has company.com
domain , provides name.surname@company.com
user accounts @ google. there team drive employees. 1 of accounts (not admin) used create service account , these steps done far:
- created project organization in google cloud platform
- enabled google drive api
- created service account
- created key service account
- assigned editor/owner role in iam tab
- enabled g suite domain-wide delegation service account using client id described here using g suite admin account.
i couldn't find mention in documentation how grant service account access team drive uploaded files/folders visible users have access team drive. useful link on how appreciated lot.
for now, when create folder or upload file using service account, puts them in private drive belongs service account only.
there possible workaround: upload files service account's private drive , share them users (this not preferred requirements), still, if tells how this, i'll happy.
here steps grant access based on documentation comment in addition steps in question.
these steps require account services , apps admin role.
- sign-in google admin , go apps -> g suite -> drive , docs -> sharing settings sub-menu , select on sharing options
- click on manage team drives sub-menu , click on team drive want grant access to
- click on add members in member access pop-up
- enter service account account id (email), choose access level (i chose full), check skip sending notification , click on send
assuming authentication part set properly, here simple code gets service account's team drives:
var teamdrivelist = service.teamdrives.list(); teamdrivelist.fields = "teamdrives(kind, id, name)"; var teamdrives = teamdrivelist.execute().teamdrives; if (teamdrives != null && teamdrives.count > 0) { foreach (var drive in teamdrives) { console.writeline("{0} ({1})", drive.name, drive.id); } }
more on fields
parameter syntax here
Comments
Post a Comment