Google Drive Java API V3删除自定义属性

时间:2016-11-22 10:24:41

标签: java google-drive-api

我正在使用带有服务帐户的Google Drive API for Java,我想要删除由我自己设置的服装属性。

https://developers.google.com/drive/v3/web/migration我读到我需要使用地图更新文件,其中我将密钥设置为空值。

(files.update with {'properties':{'key':null}})

我的代码如下:

File body = new File();
Map<String, String> map = new HashMap<>();
map.put(propertyName, null);
body.setProperties(map);
service.files().update(fileId, body).execute();

JSON内容为{properties={test=null}}

上面的代码没有任何异常,但属性仍然设置。我该如何删除该属性?

1 个答案:

答案 0 :(得分:0)

Fromapi V2到v3在删除,更新属性和其他一些函数调用时,几乎没有进行任何更改。请确认https://developers.google.com/drive/v3/web/migration#methods
在此页面中,您可以找到 properties.delete,properties.get和properties.insert
对于v3中的deleteproperties
PRIVATE:files.update with {&#39; appProperties&#39;:{&#39; key&#39;:null}}
PUBLIC:files.update,{&#39;属性&#39;:{&#39; key&#39;:null}}

由于