月: 2011年12月

  • Google Documents List Data API 共有編

    Googleドキュメント上のファイルの共有は,以下のように行います。

    本当は「リンクを知っている全員」への共有を行いたかったのですが,あれこれ設定を変えて試しても,「ウェブ上で一般公開」の共有にしかできませんでした。

        GDataCredentials^ c = gcnew GDataCredentials(email, password);
        RequestSettings^ r = gcnew RequestSettings(appname, c);
        DocumentsRequest^ dr = gcnew DocumentsRequest(r);
        Document^ doc = SortTable[sel]->GetDoc();
        DocumentEntry^ entry = doc->DocumentEntry;
        AclQuery^ query = gcnew AclQuery(entry->AccessControlList);
        AclFeed^ aclFeed = dr->Service->Query(query);
        AclEntry^ aclentry = gcnew AclEntry();
        aclentry->Role = gcnew AclRole("reader");
        AclScope^ scope = gcnew AclScope();
        scope->Type = AclScope::SCOPE_DEFAULT;
        scope->Value = "";
        aclentry->Scope = scope;
        aclFeed->Insert(aclentry);
        dr->Service->Query(query);