Trying to set permission as "fileOrganizer" for a user on a shared google drive folder, but the v3 (and v2) API giving error FileOrganizer role is only valid for shared drives, and I could NOT find a way to specify that the folder is on a shared drive.
It is possible to set same permission via UI.
Code
gapi.client.drive.permissions
.create({
fileId: folderId,
sendNotificationEmail: false,
supportsAllDrives: true,
role: 'fileOrganizer' // 'writer' works
type: 'user',
emailAddress
}).then(
API Response
{
"error": {
"errors": [
{
"domain": "global",
"reason": "fileOrganizerOnNonTeamDriveNotSupported",
"message": "FileOrganizer role is only valid for shared drives."
}
],
"code": 403,
"message": "FileOrganizer role is only valid for shared drives."
}
}
Points to note
- For a shared drive, some API documents requires setting "supportsAllDrives" parameter to true, but API document indicates it as deprecated.
- This document explains Specific roles for shared drives, but there is no way to mention that permissions.create request is for a shared drive.
- files.list API has option to pass driveId by setting 'corpora': 'drive' which indicates a shared drive, but similar option is not available for
permissions.create.
I tried various combinations like passing driveId without any luck. Are there any other options?