【问题标题】:Can I access a Sharepoint calendar using Microsoft Graph?我可以使用 Microsoft Graph 访问 Sharepoint 日历吗?
【发布时间】:2018-09-05 22:44:54
【问题描述】:

我需要从 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
    )

没有列出任何事件。我还尝试了 /sites/{site-id}/lists/{list-id}/items,如 Microsoft's API reference docs 所示。这不显示事件。是否可以通过这种方式提取事件?

【问题讨论】:

    标签: sharepoint office365 microsoft-graph-api


    【解决方案1】:

    首先,对于您提到的问题“/sites/{site-id}/lists/{list-id}/items” 这仅在 graph api beta 版本中可用,是的,不要在产品的生产版本中使用它。

    https://.sharepoint.com/site//_api/web/lists/getbytitle('Calendar')/items
    

    请尝试使用上述代码检索您的日历项目。

    【讨论】:

      【解决方案2】:

      关于

      没有列出任何事件。我也试过 /sites/{site-id}/lists/{list-id}/items 如 Microsoft 的 API 所示 参考文档。这不显示事件

      很可能发生这种情况,因为每个日历都启用了项目级别权限

      如何验证

      • 转到 SharePoint UI 中的日历设置: /_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 权限级别

      否则权限受限的用户将无法检索所有事件

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-04-01
        • 2020-08-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-10-09
        相关资源
        最近更新 更多