Access Team Drives

How to capture a Team Drive or files/folders that live on a Team Drive for downstream use:

  • drive_find() and drive_get() return a dribble with metadata on files, including folders. Both can be directed to search on Team Drives, using the optional arguments team_drive or corpus (documented below).

  • team_drive_find() and team_drive_get() return a dribble with metadata on Team Drives themselves. You will need this in order to use a Team Drive in certain file operations. For example, you can specify a Team Drive as the parent folder via the path argument for upload, move, copy, etc.

Regard the functions above as the official "port of entry" for Team Drives and Team Drive files and folders. Use them to capture your target(s) in a dribble to pass along to other googledrive functions. The general flexibility to refer to files by name, path, or id does not apply to Team Drive files. While it's always a good idea to get things into a dribble early, for Team Drives it's absolutely required.

Note: Team Drives are only available to users of certain enhanced Google services, such as G Suite Enterprise, G Suite Business, or G Suite for Education.

Specific Team Drive

To search one specific Team Drive, pass its name, marked id, or dribble to team_drive somewhere in the call, like so:

drive_find(..., team_drive = "i_am_a_team_drive_name")
drive_find(..., team_drive = as_id("i_am_a_team_drive_id"))
drive_find(..., team_drive = i_am_a_team_drive_dribble)

The value of team_drive is pre-processed with as_team_drive().

Other collections

To search other collections, pass the corpus parameter somewhere in the call, like so:

drive_find(..., corpus = "user")
drive_find(..., corpus = "all")
drive_find(..., corpus = "domain")

Possible values of corpus and what they mean:

  • "user": Queries files that the user has accessed, including both Team and non-Team Drive files.

  • "all": Queries files that the user has accessed and all Team Drives in which they are a member. If you're reading the Drive API docs, this is a googledrive convenience short cut for "user,allTeamDrives".

  • "domain": Queries files that are shared to the domain, including both Team Drive and non-Team Drive files.

API docs

googledrive implements Team Drive support as outlined here:

Users shouldn't need to know any of this, but here are details for the curious. The extra information needed to search Team Drives consists of the following query parameters:

  • corpora: Where to search? Formed from googledrive's corpus argument.

  • teamDriveId: The id of a specific Team Drive. Only allowed -- and also absolutely required -- when corpora = "teamDrive". When user specifies a Team Drive, googledrive sends its id and also infers that corpora should be set to "teamDrive" and sent.

  • includeTeamDriveItems: Do you want to see Team Drive items? Obviously, this should be TRUE and googledrive sends this whenever Team Drive parameters are detected

  • supportsTeamDrives: Does the sending application (googledrive, in this case) know about Team Drives? Obviously, this should be TRUE and googledrive sends it for all applicable endpoints, all the time.

  • team_drives
Documentation reproduced from package googledrive, version 1.0.0, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.