gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 07:02:10 25 4
gpt4 key购买 nike

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

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

(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}}

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

最佳答案

从 API V2 到 v3,删除、更新属性和其他一些函数调用时几乎没有进行任何更改。请验证
https://developers.google.com/drive/v3/web/migration#methods
在此页面中您可以找到属性.删除、属性.获取和属性.插入
用于 v3 中的删除属性
私有(private):files.update 与 {'appProperties':{'key':null}}
公共(public):files.update 与 {'properties':{'key':null}}

谢谢

关于java - Google Drive Java API V3 删除自定义属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40739322/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com