Pretty self-explanatory title. I'm using Google Drive Client Api for Java. What I currently have is as follows:
File f = mService.files.get(fileId).execute();
However, I can't find the property in File
used to check if a file is trashed or not. File.getExplicitlyTrashed()
gives me null for both trashed and not trashed files.
The trashed
property is hidden inside the File.Labels
class, which you can get from File.getLabels()
. A working example is:
public boolean validFileId(String id) {
try {
File f = mService.files().get(id).execute();
return !f.getLabels().getTrashed();
} catch (IOException e) {
e.printStackTrace();
System.out.println("bad id: " + id);
}
return false;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With