4
我給大家分享谷歌雲端硬盤文件的下一個方法:谷歌雲端硬盤API的Java權限500內部錯誤
public static boolean shareFile(HttpServletRequest httpReq, String fileId, String user, String rol, boolean commenter) {
Drive service = getService(httpReq) ;
if (service != null){
Permission newPermission = new Permission();
newPermission.setValue(user);
newPermission.setType("user");
newPermission.setRole(rol);
if (commenter)
newPermission.setAdditionalRoles(Arrays.asList("commenter"));
try {
service.permissions().insert(fileId, newPermission).execute();
return true;
} catch (Exception e) {
System.out.println("An error occured: " + e);
}
}
return false;
}
一切正常時可變評議是假的罰款(不設置addiotional角色),但如果我希望用戶有角色「讀者」和「評論者」,我得到了一個錯誤:
An error occured: com.google.api.client.googleapis.json.GoogleJsonResponseException: 500 Internal Server Error { "code" : 500, "errors" : [ { "domain" : "global", "message" : "Internal Error", "reason" : "internalError" } ], "message" : "Internal Error" }
就與這種問題的人的經驗?