Reputation: 441
I just follow this official document to excuse create a team.Create team I also using the client credential flow and apply all the permissions advised. In Postman, I used this message to call
{
"[email protected]":"https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
"displayName":"My Sample Team",
"description":"My Sample Team’s Description",
"members":[
{
"@odata.type":"#microsoft.graph.aadUserConversationMember",
"roles":[
"owner"
],
"userId":"xxxxx-61d8-43db-94f5-81374122dc7e"
}
]
}
but unfortunately will get such error message, I'm fully confused on this unknown Error
{
"error": {
"code": "UnknownError",
"message": "",
"innerError": {
"date": "2020-11-02T05:32:08",
"request-id": "2955c466-f25f-42f5-ba89-4a522c428b70",
"client-request-id": "2955c466-f25f-42f5-ba89-4a522c428b70"
}
}
}
I also tried to execute it in C# code
var team = new Team
{
DisplayName = "My Sample Team558",
Description = "My Sample Team’s Description558",
Members = new TeamMembersCollectionPage() {
new AadUserConversationMember
{
Roles = new List<String>()
{
"owner"
},
UserId = "9xxxxxc9-f062-48e2-8ced-22xxxxx6dfce"
}
},
AdditionalData = new Dictionary<string, object>()
{
{"[email protected]", "https://graph.microsoft.com/v1.0/teamsTemplates('standard')"}
}
};
var result = await graphServiceClient.Teams
.Request()
.AddAsync(team);
This async call will be executed successfully and a new teams team will be also created, but the result return null, that means I could not get the team id from the result.
I could not go to the next step, such as add a new channel etc.
I'm using Microsoft.Graph v3.18.0.0
in my C# code。
UPDATE
Here is the accesstoken
Upvotes: 0
Views: 412
Reputation: 9549
I can easily reproduce your problem. The cause of this error may be that you did not grant the necessary permissions or did not grant the admin consent for this permission.
Therefore, you need to check that you have granted the necessary application permissions and Permission is granted to the admin consent.
code:
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var team = new Team
{
DisplayName = "My Sample Team",
Description = "My Sample Team’s Description",
AdditionalData = new Dictionary<string, object>()
{
{"[email protected]", "https://graph.microsoft.com/v1.0/teamsTemplates('standard')"}
}
};
await graphClient.Teams
.Request()
.AddAsync(team);
Upvotes: 1