Reputation: 75
For Google Calendar API v3, is there a way to expand an Attendee Group so that when the API returns a Calendar Event object, it returns all the Attendees in that group instead of simply returning the "group" as an Attendee.
Currently, if I invite a Group (i.e.: All Staff), the API returns the attendee group as if it was a single attendee.
<Google::Apis::CalendarV3::EventAttendee:0x000000000292b3f8 @email="[email protected]", @response_status="declined", @display_name="Attendee One">,
<Google::Apis::CalendarV3::EventAttendee:0x00000000028d0b88 @email="[email protected]", @response_status="needsAction", @display_name="All Staff">]
Instead, it would be more useful to expand the group and output all the attendees and their respective responses.
<Google::Apis::CalendarV3::EventAttendee:0x000000000292b3f8 @email="[email protected]", @response_status="declined", @display_name="Attendee One">,
<Google::Apis::CalendarV3::EventAttendee:0x000000000292b3f8 @email="[email protected]", @response_status="declined", @display_name="Attendee 2">
<Google::Apis::CalendarV3::EventAttendee:0x000000000292b3f8 @email="[email protected]", @response_status="needsAction", @display_name="Attendee 3">
<Google::Apis::CalendarV3::EventAttendee:0x000000000292b3f8 @email="[email protected]", @response_status="attending", @display_name="Attendee 4">
Upvotes: 4
Views: 1253
Reputation: 1
afak there is no way to distinct a normal email from a group email. But, when you get the event attendees, you can regex on it based on your group email name. Then using Google Directory Api you can expand the list of the group email members using manage-group-members:
# If you try to get the members list of a user email you'll get 'returned "Resource Not Found: groupKey"
page_token = None
result = []
try:
while True:
members = directory_service.members().list(groupKey=email, includeDerivedMembership=True).execute()
result = [member for member in members.get('members') if member['type'] == 'USER'
and member['status'] == 'ACTIVE']
page_token = members.get('nextPageToken')
if not page_token:
break
return result
except:
logger.exception('get_group_members: ')
But, you don't know what is their responseStatus for that event, unless you check each own personal calendar. If anyone know how to check the responseStatus from each group email member to an event invitation, it would be great to know.
Upvotes: 0
Reputation: 75
Update: Google Calendar API does not currently support the functionality to expand Attendee Groups to add individual attendees within the group as Event Attendees.
Upvotes: 3