cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sngbcn
Frequent Visitor

Issue with Create Private Channel via Power Automate?

I'm creating a flow to provision Teams with a certain structure, a template, but when I get to the point of creating the private channel there is no way to get it right. I'm always trying to do the same using the graph explorer but when I paste the json body in power automate there's an error message.

 

This is the code that works in the Graph Explorer:

POST https://graph.microsoft.com/beta/teams/{group_id}/channels
Content-type: application/json

{ "membershipType": "Private",
  "displayName": "Confidential info",
  "members":[{    
           "@odata.type":"#microsoft.graph.aadUserConversationMember",
           "user@odata.bind":"https://graph.microsoft.com/beta/users('<userID>')",
           "roles":["owner"]
            }]
}

and this is the request body according to the documentation:

POST https://graph.microsoft.com/beta/teams/{group_id}/channels
Content-type: application/json

{
  "@odata.type": "#Microsoft.Teams.Core.channel",
  "membershipType": "private",
  "displayName": "My First Private Channel",
  "description": "This is my first private channels",
  "members":
     [
        {
           "@odata.type":"#microsoft.graph.aadUserConversationMember",
           "user@odata.bind":"https://graph.microsoft.com/beta/users('{user_id}')",
           "roles":["owner"]
        }
     ]
}

I added the code from graph explorer directly to a flow but when I run it the following error message appears:

{
  "error": {
    "code": "BadRequest",
    "message": "channel cannot be null.\r\nParameter name: channel",
    "innerError": {
      "request-id": "<id>",
      "date": "<date>"
    }
  }
}

Any ideas?

Thanks!

6 REPLIES 6
efialttes
Super User
Super User

Hi!

Haven't tried myself but this article describes a similar successful scenario

https://myteamsday.com/2020/01/03/create-private-channel-graph-api/

Now, in the article's comments thread a similar issue is described

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



In fact I've tried a few approachs:

 

- @odata.bind as a string inside a variable

- the whole json inside a variable 

- the double @ sign in front if odata.bind

 

all of them with no positive results 

 

Hi @sngbcn, please show your flow. 

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

@VictorIvanidze this is the whole flow. I also add an image of the error step and message.

Flow_detailsFlow_details

 

 

Flow resultsFlow results

 

Have a look at this:

https://myteamsday.com/2020/01/03/create-private-channel-graph-api/

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

hi @VictorIvanidze @efialttes I have already followed the advice in that website without any luck. As I commented I have accomplished creating a new channel through Graph Explorer but the same code fails when running a flow...

 

Have you tried it even with a basic flow? Do you see anything missing in the http request?

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,244)