私のアプリケーションで.Net(バージョン1.9)用のGoogle Data APIを使用しています。 私はGoogle Appsアカウントを作成しましたが、私はGoogle Docsの下で「この組織外の文書を共有することはできません」と設定しました。.Net用GoogleデータAPI Google Appsアカウントの外部組織との共有を可能にする
Google docs webからドメイン(組織)外のファイルを共有しようとすると、そのファイルを自分のドメイン外で共有できないというエラーが表示されます。
しかし、私はAPIから同じことを試しても成功します。私はAPIから200の成功を収めています。共有リンクからファイルにアクセスしようとすると、「このリソースにアクセスするにはアクセス許可が必要です」と表示されます。私の質問は、APIがエラーで戻ってはいけないのですか?このケースをどうすれば処理できますか?ここで
私が使用していたコードです:
DocumentsRequest request = null;
/* request initialization */
string csBatchReqBody = "<?xml version="1.0" encoding="UTF-8"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl="http://schemas.google.com/acl/2007" xmlns:batch="http://schemas.google.com/gdata/batch"><category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/><entry><id>https://docs.google.com/feeds/default/private/full/document:1DsELtiNwq-ogOrp8cAONdMpGR4gBF79PjijTae-vVNg/acl/user:[email protected]</id><batch:operation type="query"/></entry><entry><batch:id>1</batch:id><batch:operation type="insert"/><gAcl:role value="reader"/><gAcl:scope type="user" value="[email protected]"/></entry>"
string Url = "https://docs.google.com/feeds/default/private/full/document:1DsELtiNwq-ogOrp8cAONdMpGR4gBF79PjijTae-vVNg/acl/batch";
byte[] byteArray = Encoding.ASCII.GetBytes(csBatchReqBody);
MemoryStream inputStream = new MemoryStream(byteArray);
AtomEntry reply = request.Service.Insert(new Uri(Url), inputStream, "application/atom+xml", "");
MemoryStream stream = new MemoryStream();
reply.SaveToXml(stream);
はあなたに感謝。だから私は単一の要素のバッチ要求を使用するべきではない?ちょうど明確化。 –
1回のリクエストでバッチを使用する必要はなく、実際にはオーバーヘッドが追加されます。 –