2

根据 Google Documents List Data API,可以选择复制文档: http ://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html#CopyingDocs

但是当我查看 API 的 GWT Java 文档时,这个菜单点不见了。 http://code.google.com/apis/documents/docs/3.0/developers_guide_java.html

你知道,Java GWT API 中是否有复制 GDocs 文档的方法?哪个可能只是没有记录?

查看python API,我找到了python方法: http ://code.google.com/apis/documents/docs/3.0/developers_guide_python.html#CopyingDocs

4

1 回答 1

0

我现在设法编写了自己的复制请求:

用文件键替换t7Z3GLNuO641hOO737UH60Q,你喜欢复制

String = "new File";
String userEmail= new CurrentUser ().getUser ().getEmail ();

String body = "<?xml version='1.0' encoding='UTF-8'?>"
      + "<entry xmlns=\"http://www.w3.org/2005/Atom\">"
      + "<id>t7Z3GLNuO641hOO737UH60Q</id>"
      + "<title>"+ title +"</title>"
      + "</entry>";

try {
  GDataRequest gdr = docsService.createRequest(Service.GDataRequest.RequestType.INSERT,
    new URL("https://docs.google.com/feeds/default/private/full/?xoauth_requestor_id="+ userEmail),
    ContentType.ATOM);

  gdr.setHeader("GData-Version", "3.0");
  OutputStream requestStream = gdr.getRequestStream();
  requestStream.write(body.getBytes());

  log.info(gdr.toString());
  gdr.execute();    
}
[.. catch]
于 2011-01-24T14:20:47.337 回答