Google Calendar API. Do not remove members from the visitor list using Google API Explorer.
I'm trying to remove some attendees from a Google Calendar event related to a room resource calendar when using the tool in the Try It Explorer API documentation , correctly resolved using a domain admin account that has admin rights on that calendar.
I post the request body removing two participants from the event, the API results are 200 OK, but the participants stay there.
I tried to add a new member or update their status and it works fine, but not to remove the member.
Any body know what I'm missing here? I also tried to use this via GAS and I got the same problem, but to reject any self-programming problem I tried with the official Try It API tool
Request
PATCH
https://www.googleapis.com/calendar/v3/calendars/supportworld.com.ar_34373XXXXXXXXXXX2%40resource.calendar.google.com/events/osrd3lXXXXXXXolks?fields=attendees%2Cid&key={YOUR_API_KEY}
Content-Type: application/json
Authorization: Bearer ya29.bwAXXXXXXXXJOeCUAAADDYWT-QXXXXXXXXXXrc_eGP6Lk7CXXXXXXXXJ6130__ci_-_YXXXXxs
X-JavaScript-User-Agent: Google APIs Explorer
{
"attendees": [
{
"organizer": true,
"email": "xxxxx@netuxxxxxxrp.com",
"responseStatus": "accepted",
"displayName": "AAAAAAA"
},
{
"self": true,
"resource": true,
"email": "supportworld.com.ar_34373XXXXXXXXXXX2@resource.calendar.google.com",
"responseStatus": "accepted",
"displayName": "Cafetera"
}
],
"id": "osrd3lXXXXXXXolks
"
}
answer
200 OK
cache-control: no-cache, no-store, max-age=0, must-revalidate
content-encoding: gzip
content-length: 294
content-type: application/json; charset=UTF-8
date: Thu, 28 Aug 2014 16:15:06 GMT
etag: "XXXXXXXXX"
expires: Fri, 01 Jan 1990 00:00:00 GMT
pragma: no-cache
server: GSE
{
"id": "osrd3lids0gkoeaggp2c95olks",
"attendees": [
{
"email": "xxxxx@netuxxxxxxrp.com",
"displayName": "AAAAAAA",
"organizer": true,
"responseStatus": "accepted"
},
{
"email": "yyyyy@netuxxxxxxrp.com",
"displayName": "YYYYYYY",
"responseStatus": "accepted"
},
{
"email": "zzzzz@netuxxxxxxrp.com",
"displayName": "BBBBBB",
"responseStatus": "needsAction"
},
{
"email": "supportworld.com.ar_34373XXXXXXXXXXX2@resource.calendar.google.com",
"displayName": "Cafetera",
"self": true,
"resource": true,
"responseStatus": "accepted"
}
]
}
records:
{
"email": "yyyyy@netuxxxxxxrp.com",
"displayName": "YYYYYYY",
"responseStatus": "accepted"
},
{
"email": "zzzzz@netuxxxxxxrp.com",
"displayName": "BBBBBB",
"responseStatus": "needsAction"
}
shouldn't be anymore, but they ... any help on this admitted,
source to share
I was able to get it to work. I think there is a problem with the API explorer tool.
Specifically, where you specify the body of the patch, there is a structured editor through which you can add and remove JSON sections for the contributors object. When I removed a participant from the list using the structured editor and then switched to the free-form editor, the participant was still present. Mistake!
Staying in the free-form editor, I deleted the desired member block again and executed, and everything worked as it should. I checked in a separate tab with GET that the member is indeed deleted.
(To navigate to other editors, there is a drop-down button in the upper-right corner of the pattern text box.)
source to share
It works for me in C #, I think it will work the same in other languages.
When I tried to remove the unwanted visitor from the list, it didn't work.
eventItem.Attendees.Remove(new EventAttendee { Email = "<to be removed>@gmail.com" });
I think you've gotten to this.
But when I replaced the list with another non-member list, it worked and the other members weren't even notified of any changes.
eventItem.Attendees = eventItem.Attendees.Where(a => a.Email != "<to be removed>@gmail.com").ToList();
and of course a patch / update after.
service.Events.Patch(eventItem, "primary", eventItem.Id).Execute();
source to share