对于Google Calendar API v3,有一种方法可以扩展Attendee Group,以便当API返回Calendar Event对象时,它返回该组中的所有与会者,而不是简单地返回“组” ”作为与会者。
当前,如果我邀请一个小组(即:所有员工),则API会返回与会者组,就好像它是单个与会者一样。
<Google::Apis::CalendarV3::EventAttendee:0x000000000292b3f8 @email="attendee1@gmail.com", @response_status="declined", @display_name="Attendee One">,
<Google::Apis::CalendarV3::EventAttendee:0x00000000028d0b88 @email="all_staff@gmail.com", @response_status="needsAction", @display_name="All Staff">]
相反,扩展组并输出所有与会者及其各自的回复将更为有用。
<Google::Apis::CalendarV3::EventAttendee:0x000000000292b3f8 @email="attendee1@gmail.com", @response_status="declined", @display_name="Attendee One">,
<Google::Apis::CalendarV3::EventAttendee:0x000000000292b3f8 @email="attendee2@gmail.com", @response_status="declined", @display_name="Attendee 2">
<Google::Apis::CalendarV3::EventAttendee:0x000000000292b3f8 @email="attendee3@gmail.com", @response_status="needsAction", @display_name="Attendee 3">
<Google::Apis::CalendarV3::EventAttendee:0x000000000292b3f8 @email="attendee4@gmail.com", @response_status="attending", @display_name="Attendee 4">
答案 0 :(得分:1)
更新:Google Calendar API当前不支持扩展“与会者组”的功能,以将组内的各个与会者添加为活动与会者。
答案 1 :(得分:0)
afak无法将普通电子邮件与组电子邮件区分开。但是,当您获得活动参与者时,您可以根据您的群组电子邮件名称对其进行正则表达式。然后使用Google Directory Api,可以使用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: ')
但是,除非您检查每个个人日历,否则您不知道他们对该事件的responseStatus是什么。如果有人知道如何检查每个组电子邮件成员对事件邀请的responseStatus,那真是太好了。