Cli-microsoft365: New command: Connect existing Office 365 Group to Microsoft Teams

Created on 13 Mar 2019  路  15Comments  路  Source: pnp/cli-microsoft365

Connects existing team site to Microsoft Teams

  • command: graph o365group teamify -i|--groupId <groupId>
  • groupId: The ID of the Office 365 Group to connect to Microsoft Teams

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

good first issue new feature pr-merged

Most helpful comment

Next to using the teamId, we could also use the site URL. Laura has a nice write up about how to retrieve the URL of the site that belongs to an Office 365 Group at https://laurakokkarinen.com/provisioning-teams-with-a-site-design-flow-and-microsoft-graph/.

Thank you for the API suggestions @LauraKokkarinen 馃憦

All 15 comments

hi @waldekmastykarz -> ok if I start working on this?

Please do! Appreciate your help! 馃憦

hm, @waldekmastykarz it seems I need your help.

I have the command ready to test but apparently, all I get as an answer from SharePoint is:



10005
Authentication method is not allowed.

I tried to authenticate using spo login with deviceID and user/pwd approach. In both sessions, I'm able to get site information with the spo site get, but as soon as I try my new one, I get the error from above.

I also tried to call the REST API in postman, same error. Here I get the bearer token from a tenant full control app and I'm also able to use the same token to get the site title in postman but a call to /_api/groupsitemanager/EnsureTeamForGroup fails with the above error.

If I try to connect a com site I get a different error, something like "no group present".

If I log into SharePoint in the browser with the same credentials as with the spo login user/pwd approach I'm able to connect the site there. The user is tenant admin anyways. The interesting thing is if I do connect a team site through the GUI and call the API afterwards on that particular site I get the Teams url back.

For me, the token seems ok in terms of Authentication but it lacks maybe something in terms of Authorization, which is weird because my user is tenant admin and the used app has tenant full control.

Thanks for reporting the issue @thomyg. I'll have a look at it asap to see if I can repro it.

I can repro the issue @thomyg. It seems like something has changed recently. Let's see if we can find a different approach

Seems like this is a viable alternative @thomyg https://docs.microsoft.com/en-us/graph/api/team-put-teams?view=graph-rest-1.0. Since it's an MS Graph call, we should update the spec to point to graph

Next to using the teamId, we could also use the site URL. Laura has a nice write up about how to retrieve the URL of the site that belongs to an Office 365 Group at https://laurakokkarinen.com/provisioning-teams-with-a-site-design-flow-and-microsoft-graph/.

Thank you for the API suggestions @LauraKokkarinen 馃憦

That can be incorporated also in a base class for the teams commands.

Gotcha. Will try with the help of Laura's blog to create the command and agreed on the base class @VelinGeorgiev . I will use the base class first for this command as it adds a feature. As soon as I finished all my assignments that add commands I will go for the utils things of teams like the channel validation.

Excellent @thomyg! Looking forward to it!

Moved this command a little bit down in my backlog. I started with the base class in the context of the teams-channel-remove command. If we agree on the shape of the base class I will add the connection of an existing group as discussed here.

Are you still working on it @thomyg?

Setting as free to pick up due to lack of response

I am on it!

Initial command added to the CLI. We can potentially extend it with team site url option in future. This could be separate issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

garrytrinder picture garrytrinder  路  3Comments

StfBauer picture StfBauer  路  3Comments

VelinGeorgiev picture VelinGeorgiev  路  3Comments

plamber picture plamber  路  3Comments

vineet2907 picture vineet2907  路  3Comments