Google Drive Java API V3删除自定义属性 [英] Google Drive Java API V3 delete custom property

查看:47
本文介绍了Google Drive Java API V3删除自定义属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm using the Google Drive API for Java with a service account and I want to delete costume properties which were set by myself.

https://developers.google.com/drive/v3/web/迁移我读到我需要用一个映射更新文件,在该映射中我将密钥设置为空值.

At https://developers.google.com/drive/v3/web/migration I read that I need to update the file with a map where I put the key with a null value.

(带有{'properties':{'key':null}}的files.update)

我的代码如下:

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

上面的代码可以正常工作,但是仍然设置了该属性.如何删除该财产?

The above code works without any exception, but the property is still set. How can I delete the property?

推荐答案

从Fromapi V2到v3,删除,更新属性和其他一些函数调用时所做的更改很少.请验证
https://developers.google.com/drive/v3/web/migration#methods
在此页面中,您可以找到properties.delete,properties.get和properties.insert
对于v3中的deleteproperties
PRIVATE:使用{'appProperties':{'key':null}}进行files.update
PUBLIC:使用{'properties':{'key':null}}

Fromapi V2 to v3 there are few changes are done while deleting, update properties and some other function calls. Please verify
https://developers.google.com/drive/v3/web/migration#methods
In this page you can find properties.delete, properties.get and properties.insert
for deleteproperties in v3
PRIVATE: files.update with {'appProperties':{'key':null}}
PUBLIC: files.update with {'properties':{'key':null}}

谢谢

这篇关于Google Drive Java API V3删除自定义属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆