cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
stayinginsync
Advocate II
Advocate II

Get TeamID after Cloning Team

I know I can create a Cloned Team with this HTTP Request to Office Groups:

stayinginsync_0-1649445116906.png

 

When I get the headers back, it contains the new TeamID 

"Content-Location": "/teams('NewTeamID')"

 

I already have

@{outputs('HTTP')['headers']?['content-location']}

 

Now I want to build onto this expression to extract just the "NewTeamID".

 

Any suggestions"?  Also, is this the best way to get the new TeamID after Cloning, or do you have a better recommendation?

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
VictorIvanidze
Community Champion
Community Champion

Try this:

 

split(outputs('HTTP')['headers']?['content-location'],'''')[1]

 

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.

View solution in original post

6 REPLIES 6
Rhiassuring
Super User
Super User

Hi there, 


I'm responding with an "I think.." first (because I haven't done it), and then an alternate method. 

If you want to extra the NewTeam ID from your Outputs, you could do a "Find Text Position" up to "/teams('" and then use Substring to get the ID. I suppose.

The other way is to use the "List Teams" action, then the "Filter Array". 

Rhiassuring_0-1649527652617.png

(My compose in the end is just body('Filter_array')[0]?['id'])

 

EDIT: Just a quick update since I think my post wasn't clear -- this "List Teams" is an "if nothing else works" option 😉 You 100% want to use the Substring / Split function!

______________________________________________________________


Did this answer your question? Please mark it as the solution.
Did it contribute positively towards finding the final solution? Please give it a thumbs up.

I answer questions on the forum for 2-3 hours every Thursday!



VictorIvanidze
Community Champion
Community Champion

Try this:

 

split(outputs('HTTP')['headers']?['content-location'],'''')[1]

 

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.

Hi @Rhiassuring,

please don't be offended,  but your suggestion looks illogical. 

If you've just created a team, you know it's ID , correct?  Why these actions: "List teams" etc? What if you have 1000 teams?

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.
Rhiassuring
Super User
Super User

I'm not offended at all @VictorIvanidze  ! I'm here to help where I can, and then learn from folks who have better methods -- it looks like your recommendation of using split is right on par with my first recommendation of using substring! The List Teams was the "if all else fails" method 😉 

______________________________________________________________


Did this answer your question? Please mark it as the solution.
Did it contribute positively towards finding the final solution? Please give it a thumbs up.

I answer questions on the forum for 2-3 hours every Thursday!



@VictorIvanidze 

 

UPDATE - Took a little trial and error to get it working, but that did the trick.  Thanks.

 

Thanks.  I'd definitely prefer to use "split()", but it says expression is invalid:

 

stayinginsync_0-1649695897168.png

 

Could you show the value of outputs('HTTP')?

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (5,097)