cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
stayinginsync
Helper II
Helper 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
Resident Rockstar
Resident Rockstar

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!

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
Resident Rockstar
Resident Rockstar

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 😉 

@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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (3,825)