重命名Google云端硬盘文件,返回null

时间:2014-07-28 07:03:08

标签: google-drive-api

我正在使用GD SDK for Android重命名Google云端硬盘文件,代码如下:

File file = new File();
file.setTitle(mNewName);
Files.Patch patchRequest = service.files().patch(mId, file);
patchRequest.setFields("title");
mUpdatedFile = patchRequest.execute();

文档说.execute()应该返回一个File对象,但是在这个File中只填充了patched属性,所有其他字段都为null。这是一个错误吗?

1 个答案:

答案 0 :(得分:1)

您指定只需要" title"退回:

patchRequest.setFields("title");

此字段参数控制将填充的内容。你想要这里所需的最小值,因为它更有效率。