Delete Google Doc permanently

I am trying to delete a Google document using the Java APIm, it works fine, but the document is in the trash folder. I want the document to be permanently deleted even from the recycle bin. Can someone please offer me a solution on how to work on this? This is the code I used to delete the document.

    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
source share
1 answer

Deleting a file on an ongoing basis is equivalent to sending a DELETE request to the file editing URL with the request parameter "delete = true" (skip garbage):

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 ETAG>");

If you want to bypass the etag check, you can pass a special value "*".

+3
source

All Articles