The Dropbox API for Java
offers the following approach for modifying the permissions of an existing file collaboration:
public static void updateFileMember(DbxVlientV2 client, String file, String email, AccessLevel level) throws Exception {
MemberSelector member = MemberSelector.email(email);
MemberAccessResult result = client.sharing().updateFileMember(file, member, level);
}
However, running the above method for changing the access level from VIEWER to EDITOR, results in this error:
Exception in 2/sharing/update_file_member: “no permission” (user message: you don’t have permissions perform this action.)
The same error appears for removing a file collaboration and adding it again (API 2/sharing/add_file_member
). Adding a new collaboration without having removed it earlier on, works as expected.
The application via which the API is invoked, has Full Dropbox
(as opposed to only App Folder
) access.
Is there any other way of authorizing the app to allow programmatic changes to the access level of a file, elevating it to EDITOR?
The file sharing functionality offered by addFileMember and updateFileMember does not support AccessLevel.editor
.
If you want to add editors to a file, put the file in a folder and share the folder via shareFolder
, addFolderMember
, and updateFolderMember
.
(Aside: apologies this isn't more clearly documented. This is due to the AccessLevel
object itself being shared with other methods which do support AccessLevel.editor
. I'll ask the team to clarify this in the documentation.)