Copying Google Docs documents with Java GWT
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开发者_StackOverflow中文版://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
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]
精彩评论