使用 Java GWT 复制 Google Docs 文档

发布于 2024-10-13 09:39:46 字数 767 浏览 2 评论 0原文

根据 Google 文档列表数据 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

According to the Google Documents List Data API there is an option to copy documents:
http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html#CopyingDocs

But when I look in the GWT Java docu of the API, this menu point is missing.
http://code.google.com/apis/documents/docs/3.0/developers_guide_java.html

Do you know, if there is a method to copy GDocs documents in the Java GWT API? Which maybe is just not documented?

Looking in the python API I find the python method:
http://code.google.com/apis/documents/docs/3.0/developers_guide_python.html#CopyingDocs

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不一样的天空 2024-10-20 09:39:46

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

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]

I now managed to write my own copy request:

Replace t7Z3GLNuO641hOO737UH60Q by the documents key, you like to copy

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]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文