Reputation: 7921
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.
Upvotes: 5
Views: 3158
Reputation: 7921
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;
}
Upvotes: 3