AnswerBun.com

Microsoft Teams Graph API - Invalid bind property name owners in request

Stack Overflow Asked on December 5, 2020

I’m currently having major issues with creating teams from the Graph API. I was initially trying to create teams based on groups, however I have found out today that you can now create a team without creating a group first then waiting 15 minutes to then create the team from the following link. This would make things considerably simpler.

https://docs.microsoft.com/en-us/graph/api/team-post?view=graph-rest-1.0

I am using the Microsoft.Graph SDK (v3.12.0 released 26th Aug) so replicated the http call using the SDK as follows.

        var team = new Team
        {
            DisplayName = "My Group Name",
            Description = "My Group Description",
            AdditionalData = new Dictionary<string, object>()
            {
                {"[email protected]", "https://graph.microsoft.com/v1.0/teamsTemplates('educationClass')"},
                {"[email protected]", $"["https://graph.microsoft.com/v1.0/users('{usersGuid}')"]"}
            },
        };

        var response = await _graphClient.Teams
            .Request()
            .AddAsync(team);

The code above gives a:

[16:14:01 ERR] An unhandled exception has occurred while executing the request.
Status Code: BadRequest
Microsoft.Graph.ServiceException: Code: BadRequest
Message: Invalid bind property name owners in request.

If I remove the line

{"[email protected]", $"["https://graph.microsoft.com/v1.0/users('{usersGuid}')"]"}

from the code I get the following:

ErrorMessage : {"errors":[{"message":"A team owner must be provided when creating a team in application context."}]

Any advice would be greatly appreciated.

Thanks,
Nick

One Answer

In v1.0 the owners relationship is not currently present, so you have to use the beta endpoint. POST: https://graph.microsoft.com/beta/teams

with the following body format

{ "[email protected]":"https://graph.microsoft.com/beta/teamsTemplates('standard')", "displayName":"Test Team", "description":"Test description", "[email protected]":["https://graph.microsoft.com/v1.0/users/{user guid}"] }

Note: the user guid should also be bare, i.e without the brackets and quotes in your example.

Correct answer by David on December 5, 2020

Add your own answers!

Related Questions

How can I get different margins when appending divs in CSS?

4  Asked on February 4, 2021 by michaelstackquestion

     

Getting error while running merged jtl files

2  Asked on February 4, 2021 by ajij-shaikh

   

Why don’t need to use free() function in this case?

2  Asked on February 4, 2021 by akrilmokus

     

how to show data of databse in navigation bar on laravel 7

2  Asked on February 4, 2021 by fahad-munir

     

String formatting: optional section

1  Asked on February 3, 2021 by cerno

     

Multiple table to encode json and display

1  Asked on February 3, 2021 by j-wujeck

   

i need to remove duplicated comments from every post

1  Asked on February 3, 2021 by rabie_alkholi

         

Why is C is much slower as compared to Java?

1  Asked on February 3, 2021 by jaysmito-mukherjee

       

Server returned HTTP response code: 429 for URL JAVA Reddit JSON

2  Asked on February 3, 2021 by luke-prior

     

How to measure sequential memory read speed in C/C++

1  Asked on February 3, 2021 by sz-ppeter

 

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir