消息不显示 GraphAPI Schema Extensions

问题描述 投票:0回答:1

我想在邮件中添加一些自定义数据,并能够通过使用GraphAPI来过滤它们。到目前为止,我已经创建了一个Schema扩展,并且当我询问 https:/graph.microsoft.comv1.0schemaExtensionsourdomain_EmailCustomFields。:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#schemaExtensions/$entity",
    "id": "ourdomain_EmailCustomFields",
    "description": "Custom data for emails",
    "targetTypes": [
        "Message"
    ],
    "status": "InDevelopment",
    "owner": "hiding",
    "properties": [
        {
            "name": "MailID",
            "type": "String"
        },
        {
            "name": "ProcessedAt",
            "type": "DateTime"
        }
    ]
}

然后我修补了一个特定的信息 https:/graph.microsoft.comv1.0memailFoldersInboxMessageshidingmessageid。:

PATCH Request
{"ourdomain_EmailCustomFields":{"MailID":"12","ProcessedAt":"2020-05-27T16:21:19.0204032-07:00"}}

问题是当我选择邮件时,通过执行GET请求,添加的自定义数据没有出现。https:/graph.microsoft.comv1.0memailFoldersInboxMessages。$top=1&$select=id,subject,ourdomain_EmailCustomFields。

另外,下面的GET请求给我一个错误。请求。https:/graph.microsoft.comv1.0memailFoldersInboxMessages。?$filter=ourdomain_EmailCustomFieldsMailID eq '12' Response:

{
    "error": {
        "code": "RequestBroker--ParseUri",
        "message": "Could not find a property named 'e2_someguid_ourdomain_EmailCustomFields' on type 'Microsoft.OutlookServices.Message'.",
        "innerError": {
            "request-id": "someguid",
            "date": "2020-05-29T01:04:53"
        }
    }
}

你有什么办法可以解决这些问题吗?

azure-active-directory microsoft-graph microsoft-graph-mail
1个回答
2
投票

我把你的schema extension复制并粘贴到我的租户中,除了用我作为所有者创建的随机应用程序注册外,然后用你的声明修补了一封电子邮件,它确实可以正常工作。

这里有几件事情,我会用微信图形资源管理器来验证一切是否正确,例如,用管理员账号登录图形资源管理器 https:/developer.microsoft.comen-usgraphgraph-explorer#。 首先确保模式扩展存在

申请获取

https:/graph.microsoft.comv1.0schemaExtensionsDOMAIN_EmailCustomFields。

它应该返回你创建的schemaextension.then

运行一个get请求,获取你所修补的实际邮件,而不是你暂时过滤的所有邮件。

https:/graph.microsoft.comv1.0memailFoldersInboxMessagesMESSAGEID。$select=DOMAIN_EmailCustomFields。

这里的响应应该是你打了补丁的电子邮件,你的EmailCustomField应该在数据中的某个地方,如果没有,说明你的补丁没有用。

然后你可以从图形资源管理器中再次运行补丁。

我都是在图形浏览器上做的,这是最简单的确认方式。

还有两件事,1)也许你的get first message中的?$top=1和你修补的消息不一样?

2) 根据文档,你不能使用$filter来扩展消息实体的模式。(https:/docs.microsoft.comen-usgraphknown-issues#filtering-on-schema-extension-properties-not-supported-on-all-entity-type。)所以第二个Get永远不会成功。

希望这能帮助你排除故障。

© www.soinside.com 2019 - 2024. All rights reserved.