Uploading a file to a Team Drive hosted folder

I'm trying to upload a file to a folder that is hosted inside a Team Drive in Google Drive. I can get the Team Drive and upload a file to the main folder using:

td <- team_drive_get(team_drive_name)
drive_upload(here(file_name), path = td)

However, if I use team_drive_get with the name or the id of the subfolder I'm interested in, I get the following error:

Error: HTTP error [404] Shared drive not found: subfolder_id
  * domain: global
  * reason: notFound
  * message: Shared drive not found: subfolder_id
  * locationType: parameter
  * location: driveId

I also tried using the name parameter to access the subfolder with:

td <- team_drive_get(team_drive_name)
drive_upload(here(file_name), path = td, name=glue("/{subfolder_name}/{file_name}"))

But again this creates a file in the main folder. Is there any workaround to access the Team Drive's subfolders?

Hmm, I haven't quite sorted out how to upload into teamdrive subfolders, but I can't reproduce the error you're getting. Are you successfully logged into the right account?

When you run team_drive_get(), it returns a tibble. For example, if I get my shared tidyteam drive, I get:

(tidy_td <- team_drive_get("tidyteams"))
#> A tibble: 1 x 3
#>   name      id                  drive_resource  
#>  * <chr>     <chr>               <list>          
#>  1 tidyteams XXXXXXXXXXXXXXXXXX <named list [8]>

If you look at the nested drive_resource do you have permissions necessary if you look at td[[3]][[1]][["capabilities"]]?

Thanks for the quick reply, Mara! I seem to have the appropriate permissions:

> td[[3]][[1]][["capabilities"]]
$canAddChildren
[1] TRUE

$canChangeCopyRequiresWriterPermissionRestriction
[1] FALSE

$canChangeDomainUsersOnlyRestriction
[1] FALSE

$canChangeTeamDriveBackground
[1] FALSE

$canChangeTeamMembersOnlyRestriction
[1] FALSE

$canComment
[1] TRUE

$canCopy
[1] TRUE

$canDeleteChildren
[1] FALSE

$canDeleteTeamDrive
[1] FALSE

$canDownload
[1] TRUE

$canEdit
[1] TRUE

$canListChildren
[1] TRUE

$canManageMembers
[1] FALSE

$canReadRevisions
[1] TRUE

$canRemoveChildren
[1] FALSE

$canRename
[1] TRUE

$canRenameTeamDrive
[1] FALSE

$canShare
[1] TRUE

$canTrashChildren
[1] TRUE

I also tested editing the subfolder manually and I could do it without problem.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.