我正在使用Google API客户端上传文件并将其转换为该用户的google驱动器。如何与一个特定用户自动共享该文件?
$file = new Google_Service_Drive_DriveFile();
$file->title = $title;
$chunkSizeBytes = 1 * 1024 * 1024;
// Call the API with the media upload, defer so it doesn't immediately return.
$client->setDefer(true);
$request = $service->files->insert($file, array(
'convert' => true,
));
webapp是一种HTML表单,可根据用户数据创建文档。此文档需要稍后由我自己编辑,保存在我的谷歌硬盘中,并从用户的谷歌硬盘中删除。
实现这一目标的最佳/最简单方法是什么?
答案 0 :(得分:1)
要与Drive API共享文件,您使用Permissions.insert()
类型为“user”,“reader”,“writer”或“commenter”的角色,以及一个值为其电子邮件地址的值。有关共享文件的更多信息,请参见this developer guide。