I'm using the Google Drive API for Java (v3-rev111-1.23). I'm trying to remove a property from a resource. I followed this documentation:
https://developers.google.com/drive/v3/reference/files/update https://developers.google.com/drive/v3/web/migration#methods
This is the code I wrote:
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();
The problem is that the property is never cleared. Remains with the previous value.
If I write the generated json with:
System.out.println(service.files().update(fileId, file).getJsonContent());
I get:
{properties={propA=null}}
Using the same code to add a new property like:
properties.put("test", "yes");
I get:
{properties={test=yes}}
and it works properly.
Has someone faced and solved this problem?
I read this post Google Drive Java API V3 delete custom property from 2016, but no solution was given.
More details:
Using the try-its of the web (https://developers.google.com/drive/v3/reference/files/update) I could create properties, modify them and even delete them.
Thanks.