Unable to create a Team programmatically

拜拜、爱过 提交于 2019-12-08 03:38:11

问题


I have successfully created Office 365 Group, added members and owners and now I am trying to provision a Team for this group. How am I supposed to provision it using MS Graph in .NET Console App?

I tried the following code but I am not getting my Team.

var team = new Team
{
    GuestSettings = new TeamGuestSettings
    {
        AllowCreateUpdateChannels = false,
        AllowDeleteChannels = false
    }
};

await graphServiceClient.Groups[groupID].Team.Request().CreateAsync(team);

Response from the above code

Message: No HTTP resource was found that matches the request URI 'https://api.teams.skype.com/v1.0/groups('da87fc59-403b-4b0f-973f-f812d41143aa')/team'.

Inner error

Error Screenshot

Edit: I am using latest NUGET package for MS Graph extensions.

Edit 2: Tried to do following instead.

await graphServiceClient.Groups[groupID].Team.Request().PutAsync(team);

Got this:

Code: UnauthorizedAccess Message: Failed to execute Aad backend request GetTenantSubscribedSkusRequest. Request Url: https://graph.windows.net/dc7b2a82-XXXX-XXXX-XXXX-46122279d033/subscribedSkus?api-version=1.6, Request Method: GET, Response Status Code: Unauthorized, Response Headers: ocp-aad-diagnostics-server-name: HmmXXX+7Su9HNJVjwqsmVjPsrXXXXXXXX/iNwuI3H74= request-id: 9257706c-XXXX-XXXX-XXXX-bbf33b98da7d client-request-id: f263695b-XXXX-XXXX-XXXX-9fdf185fXXXX Strict-Transport-Security: max-age=31536000; includeSubDomains Date: Wed, 19 Jun 2019 13:20:18 GMT

Any suggestions?


回答1:


  • Make sure you are using a Delegated authentication context (a user must be signed in) with the permission Group.ReadWrite.All
  • Make sure you have consented to the application permissions (from the API permissions screen of the application registration, you'll find a Grant Consent button all the way down)
  • Use the PutAsync method (today, as you mentioned, you must create the Office 365 group first and then enable Teams)



回答2:


Can you confirm that the group actually gets created? "No HTTP resource was found that matches the request URI" often means that the graphServiceClient.Groups[groupID] doesn't work. Which is likely around permissions.




回答3:


I noticed I have the same problem with application permissions. The one thing I have found that will unblock the code to work again is to create a team through the Graph Explorer and then I am good for a couple days.

Then the error comes back again and I create another team through the explorer and I can start creating like before. This tells me it is not a code problem but an issue on the Teams graph connection somewhere.




回答4:


It was a service bug. Works now.

Link to service bug on GitHub



来源:https://stackoverflow.com/questions/56666870/unable-to-create-a-team-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!