Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

Create a Team in MS teams and adding Team members (Return Value Error)



I am developing a Canvas PowerApps that creates Teams in MS Teams and adds members and owners. I can already create the Teams, and I have two collections that have users Ids. My problem is how to add those users to the newly created Team. I am using the "MicrosoftTeams.CreateATeam"  action, which in theory returns CreateATeamResponse that contains a newTeamId value.


The code below shows the intended function. I am not sure whether the way I am trying to set a global variable "NewID" is correct or whether the ForAll function actually works. I haven't been able to test those bits because I am getting an error in the create a team bit.






After I run the app, I am getting an error that says:



MicrosoftTeams.CreateATeam failed: The data returned in the response is invalid. Response data should be a valid JSON object.



The MicrosoftTeams.CreateATeam function actually works, disregarding the error. The new Team gets created in MS Teams, and I am the owner. However, I think that, due to the error, the function is not returning the new Id, which prevents me from testing the rest of my code. I already isolated the code and run a play canvas with a button that only creates the new Team:






However, the error persist. This error only shows after running the app. Before, it doesn't show the red underlines on me code:




Few reasons are under my radar, but I am an amateur when it comes to coding and, this is my first ever PowerApps application, so not sure I am on the right track or whether I am making a rookie mistake. 


  • I read something about Asynchronous function. I have no idea whether it is relevant here, but I know that the new Id would need to come from Teams, meaning that my app might not be waiting for the response (???).
  • The function is broken, and there is no return value. I notice that there is barely any comments or post using this function. Not sure it has been tested enough.

Anyway, feel free to ask additional questions and constructively criticise my coding.


Thanks in advance.

Resolver I
Resolver I

@ooramirez just tested the MS Teams connector in power Apps, seems like some issue with it.

I was able to create the MS Teams successfully but later it threw error. 






I also found this article where others are facing same issue. you can create MS Teams using Power Automate, simple and stable.


Create and add users in MS Teams using - Power Automate -

Create and Add users in MS teams using - Graph API and Power Automate -



Please thumbs up if my reply was helpful.

Advocate I
Advocate I


The MSTeams Connector throws this issue for creating a new Team.  The team is created but the error is a pain and you don't get back the Team Identifier.

Not applicable



Appreciate this post is fairly old but I ran into the same issue and while I haven't come up with an elegant solution I did come up with a workaround. My scenario is very similar in that I want to automatically create a new team and add one or more members. My workaround is as follows:


    "Automatically created via Project Controls Power Apps app"
    First(Filter(MicrosoftTeams.GetAllTeams().value, displayName = txtMSTeamsName.Text)).id,
    {owner: true}

The txtMSTeamsName contains the name of the team to be created. 


Hopefully, this will help someone.

Helpful resources

Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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