我是google doc api的新用户,并使用google doc api 3rd version with java,
I m trying to share doc with permission and want to change permission on different call,
Here there is some code which i had designed to share persmission and update and delete permission , but some how i wil got some problem on each operation,
On first time i can share docs with permission , but once i had share and again try to share with other permission then it cant allow me to upda so what should be i missing at here ,
AclEntry acl = new AclEntry();
AclScope aclScope = new AclScope(AclScope.Type.USER,"xyz@gmail.com");
acl.setScope(aclScope);
//AclRole aclRole = new AclRole();
acl.setRole(AclRole.READER);
URL url = buildUrl(URL_DEFAULT + URL_DOCLIST_FEED + "/" + folderResId + URL_FOLDERS + "/" + entry.getResourceId());
System.out.println(url.toString());
System.out.println("url : "+entry.getAclFeedLink().getHref());
// For Insert
//service.insert(new URL(entry.getAclFeedLink().getHref()), acl);
// For Update
//service.getRequestFactory().setHeader("If-Match", "*");
//service.update(new URL(entry.getEditLink().getHref()), acl);
// For Delete
service.getRequestFactory().setHeader("If-Match", "*");
service.delete(new URL(entry.getEditLink().getHref()), aclScope);
after insert first tim eif itry to insert again i wil get this error..
com.google.gdata.util.VersionConflictException: This user already has access to the document.
After insert if i try to delete that then i wil get this error
com.google.gdata.util.InvalidEntryException: Unexpected resource version ID
thnaks in advance,
答案 0 :(得分:0)
只是关于你的第一条错误消息的评论:根据我对这个api的经验,这是事实上预期的行为,只要你试图插入一个等同于已经存在的acl记录。换句话说,您无法插入现有acl记录的副本,在尝试执行此操作时始终会获得该异常。