2012-04-12 112 views
3

我想通過使用Java APIm刪除Google文檔,但它工作正常,但文檔已在垃圾文件夾中解決。我希望文檔即使從垃圾桶中永久刪除。有人可以建議我解決這個問題嗎?這是我用來刪除文檔的代碼。永久刪除Google文檔

DocsService docsService = new DocsService(domain); 
    URL docURL = new URL("https://docs.google.com/feeds/default/private/full/"+resourceId+"?xoauth_requestor_id=" + loginUser);//No I18N 
    DocumentListEntry sd=docsService.getEntry(docURL, DocumentListEntry.class); 
    sd.delete(); 

回答

3

刪除文件永久相當於把刪除發送請求到文件的編輯網址與查詢參數「刪除=真」(跳過垃圾):

DocsService docsService = new DocsService(domain); 
URL docURL = new URL(
    "https://docs.google.com/feeds/default/private/full/"+resourceId+"?xoauth_requestor_id=" + loginUser + "&delete=true"); 
docsService.delete(docURL, "<ENTRY'S ETAG>"); 

如果要逐通過「etag」檢查,您可以通過特殊值"*"