Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
769 views
in Technique[技术] by (71.8m points)

.net core - Could not find member '@odata.type' on object of type 'TeamMemberSettings'

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

the line:

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

Shows an error that does not make sense to me.

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.

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?

Thanks for any help.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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
};

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...