我需要从SharePoint上的共享日历中提取事件。
使用Microsoft Graph我发现了日历:
https://graph.microsoft.com/v1.0/sites/company.sharepoint.com/lists/CALENDAR_ID
其中包括一个列表数组。然后我尝试了:
https://graph.microsoft.com/v1.0/sites/company.sharepoint.com/lists/CALENDAR_ID/list
哪个回报:
[_decodedBody:Microsoft\Graph\Http\GraphResponse:private] => Array
(
[@odata.context] => https://graph.microsoft.com/v1.0/$metadata#sites('company.sharepoint.com')/lists('CALENDAR_ID')/list
[contentTypesEnabled] => 1
[hidden] =>
[template] => events
)
没有列出任何活动。我还尝试了Microsoft's API reference docs上显示的/ sites / {site-id} / lists / {list-id} / items。这不显示事件。是否有可能以这种方式提取事件?
关于
没有列出任何活动。我还尝试了/ sites / {site-id} / lists / {list-id} / items,如Microsoft的API参考文档所示。这不显示事件
最有可能的是,因为每个日历启用了“项目级别”权限。
如何验证
/_layouts/15/listedit.aspx?List={list-id}
Advanced Settings
下验证是否选择了Read items that were
created by the user
如果选择了Read items that were created by the user
选项,则端点https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items
将仅返回当前用户创建的事件
为了返回所有事件,可以考虑以下选项:
1)通过将日历设置为Read all items
来禁用每个日历的项级别权限
2)或利用SharePoint API端点来检索所有事件:https://server/_api/web/lists/getbyid('<list-id>')/items
根据用户权限,您可能需要启用Override List Behaviors
权限级别
否则具有受限权限的用户将无法检索所有事件