【问题标题】:Fetching Outlook e-mail categories from Microsoft Graph从 Microsoft Graph 获取 Outlook 电子邮件类别
【发布时间】:2018-03-12 11:15:32
【问题描述】:

我只想从 Microsoft Graph / Outlook 端点获取属于电子邮件的特定类别。但是它给了我相关电子邮件中存在的所有类别。

[https://graph.microsoft.com/beta/me/outlook/masterCategories/?$filter = displayName eq '红色类别']

以上链接是我对 Microsoft Graph API 的查询,我得到以下结果 { "@odata.context": "https://graph.microsoft.com/beta/$metadata#users('1e69674d-b0b3-404e-ae2d-a758569ce83c')/outlook/masterCategories", "value": [ { "id": "347a7dcc-6c61-4c93-85a5-eb75f973a77f", "displayName": "Red category", "color": "preset0" }, { "id": "643d45c3-aecb-4fbb-8254-c2520f01cf20", "displayName": "Orange category", "color": "preset1" }, { "id": "d06a692a-9406-4052-9b1e-bc7ae293a4e4", "displayName": "Yellow category", "color": "preset3" }, { "id": "8c3e842d-427f-4480-8459-e3e4e785fa85", "displayName": "Green category", "color": "preset4" }, { "id": "11502440-1912-4de1-afad-c2209178219d", "displayName": "Blue category", "color": "preset7" }, { "id": "f3f1b1ca-b319-4951-9eeb-954a169e3d71", "displayName": "Purple category", "color": "preset8" }, { "id": "1fc2506b-2676-447c-bfa3-44a3a7a2dc2d", "displayName": "Important", "color": "preset14" }, { "id": "8926f11d-23ba-4804-ace7-8ae349f390a6", "displayName": "Caution", "color": "preset16" }, { "id": "60434e45-effa-40d7-b753-705d59ef3440", "displayName": "Star", "color": "preset2" } ] }

通过 displayName 等属性过滤类别的任何方法?

【问题讨论】:

    标签: microsoft-graph-api


    【解决方案1】:

    根据官方指南,支持{id}过滤。

    https://graph.microsoft.com/beta/me/outlook/masterCategories/8cefb2b7-8f81-47e3-b6d3-a8e2dd4ac42a
    

    https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/outlookcategory_get

    【讨论】:

    • 感谢您的回复,但他们还有其他选择吗?我只是通过 displayName 并获得唯一的那个类别?
    • 我无法让 ?$filter 工作,即使文档提到它支持 OData 查询参数以帮助自定义响应。
    【解决方案2】:

    /me/ 通常不会很好地为我返回过滤器。

    尝试调用

    /users/{id}/outlook/masterCategories?filter=displayName eq '红色类别'

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-10-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多