0

ファイルをアップロードし、すぐに許可->更新を行います:

public function  sharingFile() {
    $fileId = $this->file['id'];
    $permissionId = $this->file['userPermission']['id'];
    try {
        $permission = $this->service->permissions->get($fileId, $permissionId);
        $permission->setRole('writer');
        $permission->setType('default');
        print_r($permission);
        return $this->service->permissions->update($fileId, $permissionId, $permission);
    } catch (Exception $e) {
        return "Error: " . $e;
    }
    return NULL;
}

エラーが発生します:

Error: exception 'Google_ServiceException' with message 'Error calling PUT
https://www.googleapis.com/drive/v2/files/0B6xE_F1PfpXTbF9IdHgxbEJueEk/permissions/me:
(400) Bad Request' in Z:\home\site.com\www\google-api-php-client\src\io\Google_REST.php:66
Stack trace:
#0 Z:\home\site.com\www\google-api-php-client\src\io\Google_REST.php(36):  Google_REST::decodeHttpResponse(Object(Google_HttpRequest))
#1 Z:\home\site.com\www\google-api-php-client\src\service\Google_ServiceResource.php(186): Google_REST::execute(Object(Google_HttpRequest))
#2 Z:\home\site.com\www\google-api-php-client\src\contrib\Google_DriveService.php(774): Google_ServiceResource->__call('update', Array)

ライブラリのバグでしょうか?
助けてください。

4

1 に答える 1

0

あなたのコードは、ドキュメント所有者のアクセス許可を更新し、代わりにそのユーザーをライターにしようとしています。ドライブ ドキュメントの所有者は 1 人だけである必要があるため、リクエストは無効です。

于 2013-03-11T17:18:59.187 に答える