更新时间:2022-04-02 22:09:08
I don't see any error with your code on how to move a file to trash wherein you'll use files.update
with {'trashed':true}
.
此线程中的代码示例:
解决方案是创建一个空的File设置,仅设置新值:
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();
我已经在Google云端硬盘中尝试过此操作尝试一下!并将文件成功移至回收站.
I have tried this in Google Drive Try it! and successfully moved the file to trash.
只需确保File
引用com.google.api.services.drive.model.File
,并且不是 java.io.File
.
Just make sure that the File
refers to com.google.api.services.drive.model.File
and it is not java.io.File
.