0

私はgoogle doc apiが初めてで、javaでgoogle doc api 3rdバージョンを使用しています。

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 に答える