我想通过删除文件权限来从与我共享的文件中删除文件。 但是由于权限不足,我无法删除它。如何删除它?
我到目前为止所做的:
获取文件的元数据及其 permissionId
{
"kind": "drive#file",
"id": "1pPGyU9XvliI4U8910uehkuQ-vuuRXEVD",
"name": "Die Hard (1988) 1080p BDRip Org DD 5.1 [Hindi + English] x264 ESubs.mkv",
"mimeType": "video/x-matroska",
"starred": false,
"trashed": false,
"explicitlyTrashed": false,
"spaces": [
"drive"
],
"version": "135",
"webContentLink": "https://drive.google.com/uc?id=1pPGyU9XvliI4U8910uehkuQ-vuuRXEVD&export=download",
"webViewLink": "https://drive.google.com/file/d/1pPGyU9XvliI4U8910uehkuQ-vuuRXEVD/view?usp=drivesdk",
"iconLink": "https://drive-thirdparty.googleusercontent.com/16/type/video/x-matroska",
"hasThumbnail": true,
"thumbnailLink": "https://lh3.googleusercontent.com/iVzSamm0mJK92lc16EW4TsFy8GZhcbKwUIzIwaGPtT9p2HV9bQl5SogR_nzb1zcihi5BZQ3qey0=s220",
"thumbnailVersion": "1",
"viewedByMe": true,
"viewedByMeTime": "2019-06-26T17:00:11.924Z",
"createdTime": "2018-05-16T09:54:34.010Z",
"modifiedTime": "2018-05-16T10:24:01.186Z",
"modifiedByMe": false,
"sharedWithMeTime": "2018-10-21T17:22:57.170Z",
"owners": [
{
"kind": "drive#user",
"displayName": "free ac",
"me": false,
"permissionId": "00202688946253680238",
"emailAddress": "freeac331@gmail.com"
}
],
"lastModifyingUser": {
"kind": "drive#user",
"displayName": "free ac",
"me": false,
"permissionId": "00202688946253680238",
"emailAddress": "freeac331@gmail.com"
},
"shared": true,
"ownedByMe": false,
"capabilities": {
"canAddChildren": false,
"canChangeCopyRequiresWriterPermission": false,
"canChangeViewersCanCopyContent": false,
"canComment": false,
"canCopy": true,
"canDelete": false,
"canDownload": true,
"canEdit": false,
"canListChildren": false,
"canMoveItemIntoTeamDrive": false,
"canMoveItemOutOfDrive": false,
"canReadRevisions": false,
"canRemoveChildren": false,
"canRename": false,
"canShare": false,
"canTrash": false,
"canUntrash": false
},
"viewersCanCopyContent": true,
"copyRequiresWriterPermission": false,
"writersCanShare": true,
"originalFilename": "Die Hard (1988) 1080p BDRip Org DD 5.1 [Hindi + English] x264 ESubs.mkv",
"fullFileExtension": "mkv",
"fileExtension": "mkv",
"md5Checksum": "7fdc6768744557159d790037c808c99c",
"size": "2565619212",
"quotaBytesUsed": "0",
"headRevisionId": "0B8kwukeDiZGLUHpUN0xXTllYRnRBbFZYMzNsbjFUK01jZ2tVPQ",
"videoMediaMetadata": {
"width": 1920,
"height": 800,
"durationMillis": "7929080"
},
"isAppAuthorized": false
}
我试图删除权限
fileId:1pPGyU9XvliI4U8910uehkuQ-vuuRXEVD
权限ID:00202688946253680238
{
"error": {
"errors": [
{
"domain": "global",
"reason": "insufficientFilePermissions",
"message": "The user does not have sufficient permissions for this file."
}
],
"code": 403,
"message": "The user does not have sufficient permissions for this file."
}
}
但是无法从与我共享的文件中删除文件。
编辑1:
我正在用this
对此进行测试编辑2:
我正在尝试使用Google Drive API来this
答案 0 :(得分:0)
您收到insufficientFilePermissions
错误,因为只有文件所有者可以编辑它们。如您所见:
"ownedByMe": false,
当前无法通过API从“共享文件”中删除文件,因此选项是要求所有者停止与您共享文件或通过Drive GUI删除文件。 < / p>
编辑:
可以执行以下步骤:
Drive.list
获取文件的ID permissions.list
的fileID获取权限ID permissions.delete
删除权限
步骤3中的PermissionID。