0

我是 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,
4

1 回答 1

0

只是对您的第一条错误消息的评论:根据我对这个 api 的经验,这实际上是预期的行为,只要您尝试插入与已经存在的 acl 记录等效的记录。换句话说,您不能插入现有 acl 记录的副本,当您尝试这样做时总是会遇到该异常。

于 2012-06-07T17:30:16.727 回答