“I’m using Power Automate to create Teams and folder structure in that team, but it keeps telling me that the SharePoint address doesn’t exist!”
Every time you create a new team in Teams, you create also a new SharePoint site. That’s where all the files are being stored – in the good, old SharePoint. But that also means that if you want to create a folder structure in the new team, you create the folders on that SP site. Which is quite easy as Power Automate has actions to do that, all you need is the SharePoint site address. An address that can be different from the team name…
Why is there a difference?
When you create a new team, all you have is the team name. And since there’s no limitation for any special characters, you can get very creative with the team name. But it’s a bit different with the underlying SharePoint site url. The url is very strict about the allowed characters and it’ll ignore the invalid ones.
Taken to the extreme, the SP site url can have nothing in common with the team name.
How to get the SharePoint address?
Since you can’t use the team name, you’ll have to look elsewhere, more specifically in the M365 groups.
Each team doesn’t have only its own SharePoint site, it has also a dedicated Microsoft 365 group. And such group combines the two pieces of information you need – name and email. As with the team name, there’s no limitation on the group name, but as with the SharePoint site url, there’s a limitation on the characters in the email. To put it more directly, the group name = team name, the group email = the SP site url.
After you create the team, list all your owned groups – you created the team, you’ll be one of the owners…
…add ‘Filter array’ to search for a group with the team name…
…and take the ‘Nickname’ output. Don’t worry about the ‘Apply to each’, if the team name is unique it’ll return just one entry. You can also add a ‘Delay’ action before listing the groups to make sure there’s enough time to create everything.
Summary
As with SharePoint internal name, there can be a difference between a Teams team name and the underlying SP site address, which can be a problem in a Power Automate flow. In such situations you always need some connector between the values – this time the related Microsoft 365 group. The group has the same name as the team, and the same nickname as the SharePoint site. Add the tenant url to the nickname and you’ll have the SP site url.
There is another way that is, in my opinion, easier and more straightforward. The “Create a team” action returns a Team ID. You can use that ID to query the Graph API using the ‘Send an HTTP request’ action of the O365 Groups connector (NOT the SharePoint connector).
The URI to query is the following:
https: //graph.microsoft.com/v1.0/groups/ [ID of the team] /sites/root?$select=webUrl
The returned value can then be used in subsequent actions by using the expression:
body(‘Send_an_HTTP_request’)[‘webUrl’]
Hello Oliver,
thank you for sharing, I copied the URI in the first comment and remove the others. 🙂
More straightforward if you have access to Graph API within your organisation, perhaps. Those of us working within a bureaucratic structure and not in an ICT function may find the original method much easier to navigate.
The idea of wrestling with my employer’s ICT department to get the necessary access for Graph API does not thrill me, whereas using Tom’s approach got me to exactly where I needed without having to engage ICT at all.
Thanks, Tom, for providing me a bureaucrazy-free way to achieve this!
Thanks, Oliver, worked simply great!!
Thanks also, Tom, for sharing the knowledge, as one would say ” this is the way” 🙂