在“TeamMemberSettings"类型的对象上找不到成员“@odata.type" [英] Could not find member '@odata.type' on object of type 'TeamMemberSettings'

查看:25
本文介绍了在“TeamMemberSettings"类型的对象上找不到成员“@odata.type"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 文档 将团队添加到现有 365 群组.

I am using the example from docs to add a team to existing 365 group.

行:

            await graphClient.Groups[GroupID].Team
            .Request()
            .PutAsync(team);

显示一个对我来说没有意义的错误.

Shows an error that does not make sense to me.

System.Private.CoreLib:执行函数时出现异常:Function1.Microsoft.Graph.Core:代码:InvalidRequest[10/16/2019 7:49:36 PM] 消息:在TeamMemberSettings"类型的对象上找不到成员@odata.type".路径 'memberSettings['@odata.type']',第 1 行,位置 66.,在类型为 'TeamMessagingSettings' 的对象上找不到成员 '@odata.type'.路径 'messagingSettings['@odata.type']',第 1 行,位置 205.,在类型为 'TeamFunSettings' 的对象上找不到成员 '@odata.type'.路径 'funSettings['@odata.type']',第 1 行,位置 329.,在类型为 'Team' 的对象上找不到成员 '@odata.type'.路径 '['@odata.type']',第 1 行,位置 384.

System.Private.CoreLib: Exception while executing function: Function1. Microsoft.Graph.Core: Code: InvalidRequest [10/16/2019 7:49:36 PM] Message: Could not find member '@odata.type' on object of type 'TeamMemberSettings'. Path 'memberSettings['@odata.type']', line 1, position 66.,Could not find member '@odata.type' on object of type 'TeamMessagingSettings'. Path 'messagingSettings['@odata.type']', line 1, position 205.,Could not find member '@odata.type' on object of type 'TeamFunSettings'. Path 'funSettings['@odata.type']', line 1, position 329.,Could not find member '@odata.type' on object of type 'Team'. Path '['@odata.type']', line 1, position 384.

我之前在控制台应用程序中完成了此操作,并且成功了.这与它是 Azure 函数还是 .NET Core 2.2 有什么关系?

I had this done before in a console application and it worked. Does it have anything to do with the fact that it is an Azure function or that it is .NET core 2.2?

感谢您的帮助.

推荐答案

问题是我们开始在所有模型上设置 odata.type.类型设置正确,只是服务没有像预期的那样忽略该值.这是由于客户端库中的更改而暴露的服务问题.客户端解决方法是在创建 Teams 对象时将 odatatype 属性设置为 null.

The issue is that we started setting odata.type on all models. The type is correctly set, it is just that the service isn't ignoring the value as should be expected. This is a service issue that was exposed by a change in the client library. The client workaround is to set the odatatype property to null when creating the Teams objects.

Team newTeam = new Team()
{
    GuestSettings = new TeamGuestSettings
    {
        AllowCreateUpdateChannels = false,
        AllowDeleteChannels = false,
        ODataType = null
    },
    MemberSettings = new TeamMemberSettings
    {
        AllowCreateUpdateChannels = false,
        ODataType = null
    },
    MessagingSettings = new TeamMessagingSettings
    {
        AllowUserEditMessages = true,
        AllowUserDeleteMessages = true,
        ODataType = null
    },
    FunSettings = new TeamFunSettings
    {
        AllowGiphy = true,
        GiphyContentRating = GiphyRatingType.Strict,
        ODataType = null
    },
    ODataType = null
};

这篇关于在“TeamMemberSettings"类型的对象上找不到成员“@odata.type"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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