如何使用API​​创建事件日历Microsoft-GraphAPI

时间:2020-05-27 13:33:05

标签: microsoft-graph-api microsoft-teams office365api

似乎这个API https://docs.microsoft.com/en-us/graph/api/user-post-events?view=graph-rest-1.0&tabs=http 可以与应用程序令牌一起使用。.

但是当我使用这种POST格式时:

  /users/{id | userPrincipalName}/calendars/{id}/events

我认为第一个id =是用户365的

第二个id =该用户日历的id 示例:https://graph.microsoft.com/v1.0/users/7abea3d2-9c59-4910-90c8-24a626a2ed0f/calendar/AAMkADRiNWMwZDIwLTNkNWMtNDlhZi04ODAxLTQyZjI0NGZjZjZiYgBGAAAAAADdzAdsxNzoS5NsTnjM9VXMBwDeKuBOt9H8SaQ6MfKsS4oyAAAAAAEGAADeKuBOt9H8SaQ6MfKsS4oyAAAAADKcAAA=/events

结果是这样的:

{
  "error": {
    "code": "BadRequest",
    "message": "Resource not found for the segment 'AAMkADRiNWMwZDIwLTNkNWMtNDlhZi04ODAxLTQyZjI0NGZjZjZiYgBGAAAAAADdzAdsxNzoS5NsTnjM9VXMBwDeKuBOt9H8SaQ6MfKsS4oyAAAAAAEGAADeKuBOt9H8SaQ6MfKsS4oyAAAAADKcAAA='.",
    "innerError": {
      "request-id": "11055856-32b4-4485-bf28-23e380d9e4ed",
      "date": "2020-05-27T13:22:23"
    }
  }
}

您有什么建议吗?

1 个答案:

答案 0 :(得分:1)

@感谢@Homungus评论...日历字符串中缺少s并可以正常工作!