Wednesday, November 8, 2017

Programmatically enable Teams on an existing Office 365 Group via the Microsoft Graph

Microsoft recently released PowerShell commands to work with Microsoft Teams, which is something we’ve been longing for since Teams was released. We now get commandlets to create and manage teams and channels.

PowerShell is nice and all, but if you already have a lot of Office 365 Groups, or have your own provisioning solution for Office 365 Groups, enabling Teams on these groups is something you want to add into your existing process.

image

And turns out it’s quite easy. I fired off Fiddler to see what was happening when executing the PowerShell commands, and lo and behold, we see queries running against the Microsoft Graph. The creation of the group itself happens against the /edu/groups which I’ve never seen before, but that’s not interesting. The next call to create a Team on the group is the important one.

Run an empty payload of {} with a PUT to /beta/groups/<group id>/team and you’re all set. This command will effectively enable Teams on any group (not Yammer ones). Have existing or new Office 365 Groups? Use the above REST command to enable Teams.

I expect the documentation to be updated soon as this is pretty cool stuff, and guess this will move to the v1.0 endpoint in due time. You can read the docs at https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/group_put_team. Also note that app only takes seems not to be supported at this time.

See the complete listing of PowerShell functions to see what is possible in terms of modifying the team and channels. I didn’t have time to trace all the calls – but should be pretty easy to figure it out if needed until docs are updated. For me, enabling of Teams is the most important at the moment.

1 comment:

  1. Hi Do you why I am getting 401 unauthorised error. Although I works through Graph Explorer. https://stackoverflow.com/questions/47220793/graph-api-put-beta-groups-groupid-team-authentication-error Thanks,

    ReplyDelete