I'm trying to add properties to files that have already been uploaded to a TeamDrive using the Drive API and a service account. I can access the files, but when I try to add a properties map to a file object and update() I get a 403 error.
...
Drive.Files.List request = service.files()
.list()
.setIncludeTeamDriveItems(true)
.setCorpora("teamDrive")
.setSupportsTeamDrives(true)
.setTeamDriveId("MAZEPX3fk38ieDu9PVL")
.setQ("name contains 'aad081cc-0929-42bf-88f9-cb43c5ed0742'");
FileList files = request.execute();
File f = files.getFiles().get(0);
Map<String, String> props = new HashMap<>();
props.put("fancyTag", "this_is_my_tag_value");
f.setProperties(props);
service.files().update(f.getId(),f).execute();
...
and it blows up with a com.google.api.client.googleapis.json.GoogleJsonResponseException:
{
"code" : 403,
"errors" : [ {
"domain" : "global",
"message" : "The resource body includes fields which are not directly writable.",
"reason" : "fieldNotWritable"
} ],
"message" : "The resource body includes fields which are not directly writable."
}
The service account has edit access to the TeamDrive in question. In the v3 docs, it says explicitly that properties are writable. So I'm wondering what have I not set, or what conditions have I inadvertently created to disallow setting properties on drive files?