我正在使用Google Calendar API中的list
方法来获取事件数据。 API已成功返回有关每个事件的基本信息,例如start
,end
,location
和attendees
,但是缺少Events Resource Reference Page上列出的guestsCanInviteOthers
和guestsCanModify
之类的字段。
为什么Calendar API也不会发送这些字段,以及如何修改对API的调用以获取这些字段?
最佳答案
我想扩展@Teyam的答案。
因此,您可以从Events.list调用中获取guestsCanModify
,guestsCanInviteOthers
和guestsCanSeeOtherGuests
。
您只需要将这些字段包括在fields
参数中即可。因此,要使它们与事件标题(摘要)一起返回,请将其传递给fields
。
items(summary,guestsCanInviteOthers,guestsCanSeeOtherGuests,guestsCanModify)
您需要在上面的字符串中保留空格。请注意,使用
fields
时,它将仅返回指定的字段,而不是返回默认响应以及您指定的内容。有关来宾权限的其他警告。与默认值不同时,将仅返回它。因此,根据文档的默认值为:
guestsCanModify: false
guestsCanInviteOthers: true
guestsCanSeeOtherGuests: true
因此,如果结果中不包含
guestsCanModify
,则是因为它是false
(默认值)。您只会在true
时看到它返回。关于javascript - Google Cal API返回不完整的事件资源,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39113987/