如何使用 REST API 在 Office 365 日历中创建新类别?

How can I create a new category in Office 365 calendar using the REST API?

我目前正在处理的应用程序在用户的 Office 365 日历中添加了新事件。我想根据某些标准以不同颜色显示事件。 我想我可以使用类别来实现这一点,但我没有找到添加新类别或至少获取用户日历中可用类别列表的方法。
我阅读了可用的文档 here,但它没有说明任何与类别相关的内容。

我们在 Microsoft Graph 测试版中添加了类别支持 API。

公告:https://blogs.msdn.microsoft.com/exchangedev/2017/10/09/new-outlook-apis-in-the-microsoft-graph-rooms-rules-categories-headers-and-time-zones/

测试版参考: https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/outlookuser_post_mastercategories

示例:

POST https://graph.microsoft.com/beta/me/outlook/masterCategories
Content-type: application/json
Content-Length: 70

{
      "displayName":"Project expenses",
      "color":"preset9"
}

您可以使用 Outlook REST API 使用 URL 执行类似的操作,例如:

https://outlook.office.com/api/beta/me/mastercategories

您还需要一个新的权限范围。对于 Graph,它是 MailboxSettings.ReadWrite(对于 Outlook https://outlook.office.com/MailboxSettings.ReadWrite API)。