无法创建架构扩展 [英] Can't create a schema extension

查看:88
本文介绍了无法创建架构扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Microsoft Graph API中创建架构扩展.

I am trying to create a schema extension in Microsoft Graph API.

但是失败,并显示错误消息属性类型对目标类型无效".

But it has failed with error message "Property type is invalid for target types".

POST https://graph.microsoft.com/v1.0/schemaExtensions
Content-type: application/json

{
    "id":"extendedData",
    "description": "Graph Learn training courses extensions",
    "targetTypes": [
        "Event"
    ],
    "properties": [
        {
            "name": "courseId",
            "type": "Integer"
        },
        {
            "name": "materialId",
            "type": "Integer"
        },
        {
            "name": "courseType",
            "type": "String"
        }
    ]
}

响应

{
    "error": {
        "code": "BadRequest",
        "message": "Property type is invalid for target types.",
        "innerError": {
            "date": ...,
            "request-id": ...,
            "client-request-id": ...
        }
    }
}

为什么我不能创建架构扩展?错误表示什么?

Why can't I create a schema extension and what error means?

推荐答案

整数基于rel ="nofollow noreferrer">支持的属性数据类型.

您可以将它们更改为 String .

请注意,您可能会遇到一个新错误:尝试更新应用程序上的复杂扩展定义:属于不同上下文的dexxxxx5-d9f9-48b1-a8ad-b7xxxxx25064.

Please note that you may will encounter a new error: Attempt to update complex extension definition on application: dexxxxx5-d9f9-48b1-a8ad-b7xxxxx25064 belonging to different context.

如果收到此错误,则意味着您仍然需要在JSON有效负载中放置一个 owner 属性.(如果未收到此错误,则无需放置 owner 属性)

If you get this error, it means you still need to put an owner property in the JSON payload. (If you don't get this error, it's unnecessary to put owner property)

注册一个Azure AD应用,并将应用ID作为 owner .

Register an Azure AD app and put the application id as the owner.

POST https://graph.microsoft.com/v1.0/schemaExtensions
Content-type: application/json

{
    "id":"extendedData",
    "description": "Graph Learn training courses extensions",
    "targetTypes": [
        "Event"
    ],
    "owner": "{application id of an Azure AD app}",
    "properties": [
        {
            "name": "courseId",
            "type": "String"
        },
        {
            "name": "materialId",
            "type": "String"
        },
        {
            "name": "courseType",
            "type": "String"
        }
    ]
}

这篇关于无法创建架构扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆