The Google Drive Rest API v3 has a Drive.Files.Delete method, but that permanently deletes the file.How do i move the file to the trash?
I looked at the docs for updating file metadata, and i tried to do this, but it doesn't seem to work:
File file = new File();
I don't see any error with your code on how to move a file to trash wherein you'll use
Sample code in this thread:
The solution is to create an empty File setting only the new values:
File newContent = new File(); newContent.setTrashed(true); service.files().update(fileId, newContent).execute();
I have tried this in Google Drive Try it! and successfully moved the file to trash.
Just make sure that the
File refers to
com.google.api.services.drive.model.File and it is not