2011-01-21 39 views
2

按照谷歌文檔列表數據API有文件拷貝到一個選項: http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html#CopyingDocs複製與Java GWT谷歌文檔文件

但是,當我看在API的GWT Java的實況,這點菜單丟失。 http://code.google.com/apis/documents/docs/3.0/developers_guide_java.html

您是否知道,如果有方法在Java GWT API中複製GDocs文檔?這可能只是沒有記錄?

尋找Python API中我發現蟒蛇方法: http://code.google.com/apis/documents/docs/3.0/developers_guide_python.html#CopyingDocs

回答

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]