I can get access to the upper level (root level) folders for my TeamDrive, but have bee unsuccessful find out how to get all the sub-folders (the children). What I'd like to perform is getting all children with one call...
I've seen the teamdrive REST API here https://developers.google.com/drive/api/v3/reference/teamdrives/list but this only retrieves the root level.
I can retrieve the next level down by taking the $folderId (this is the folder ID that we're trying to get the children for) and performing 2 calls to retrieve the next level
$optParams = array(
'supportsTeamDrives' => true,
);
$results = $service->files->get($folderId, $optParams);
$teamDriveId = $results["teamDriveId"];
then using the resulting $teamDriveId and calling a files->listFiles
$optParams = array(
'q' => "'{$folderId}' in parents and trashed = false and mimeType = 'application/vnd.google-apps.folder'",
'pageSize' => $pageSize,
'corpora' => 'teamDrive',
'includeTeamDriveItems' => true,
'supportsTeamDrives' => true,
'teamDriveId' => $teamDriveId, // this must be the parent Id
'orderBy' => 'name',
'pageToken' => $nextPageToken,
);
$results = $service->files->listFiles($optParams);
$nextPageToken = !isset($results["nextPageToken"]) ? "" : $results["nextPageToken"];
This will be slow as the folders can expand for sometime... Does anyone know how to get the FULL folder & all the children structure for my Team Drives? Does anyone know if this is even allowed? I've tried a lot of different options in my PHP code and the various REST API function test areas.