samedi 24 décembre 2016

Is there any way to create folders in My Drive through Google drive api?

We have integrated google drive api in Laravel application. We wanted to create a folder in My Drive in google drive account through google drive api, but its creating in Shared With me folder. Is there any way to create a folder in My Drive through API?.And whatever folders we create in My Drive  through google drive UI, we cant access these files/folder ids in Google drive api.Please help me.Here is the code, i used for folder creation:

$client = $this->GoogleClientAuth();
$service = new \Google_Service_Drive($client);
$fileMetadata = new \Google_Service_Drive_DriveFile(array( 'name' => $folderName,'mimeType' => 'application/vnd.google-apps.folder'));
$folder = $service->files->create($fileMetadata, array('fields' => 'id'));
$folderId = $folder->id;
$newPermission = new \Google_Service_Drive_Permission();
$value="xxxxxx@xxx.xx";
if($this->insertFolderPermission($service, 'user', 'writer', $value, $folderId)) {
printf("File id: (%s)\n", $folderId); return $folderId;
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire