【发布时间】:2018-04-18 21:35:01
【问题描述】:
我正在使用适用于 Java 的 Google Drive API (v3-rev111-1.23)。我正在尝试从资源中删除属性。 我遵循了这个文档:
https://developers.google.com/drive/v3/reference/files/update https://developers.google.com/drive/v3/web/migration#methods
这是我写的代码:
Drive service = getDriveService();
File file = new File();
Map<String,String> properties = new HashMap<>();
properties.put("propA", null);
file.setProperties(properties);
file = service.files().update(fileId, file).execute();
问题是该属性永远不会被清除。保持之前的值。
如果我用以下方式编写生成的 json:
System.out.println(service.files().update(fileId, file).getJsonContent());
我明白了:
{properties={propA=null}}
使用相同的代码添加新属性,如:
properties.put("test", "yes");
我明白了:
{properties={test=yes}}
它可以正常工作。
有人遇到并解决了这个问题吗?
我从 2016 年开始阅读 Google Drive Java API V3 delete custom property 这个帖子,但没有给出解决方案。
更多细节:
使用网络上的试用版 (https://developers.google.com/drive/v3/reference/files/update) 我可以创建属性、修改它们甚至删除它们。
谢谢。
【问题讨论】:
标签: java google-drive-api