user3629354
user3629354

Reputation: 149

Graph API - Creating Shared Teams channel not working with Power automate flow

I am trying to create a shared Teams channel with the Graph API in a Power automate flow. But get the error message "UnknownError". Ref image below. But if I copy the URI and body and try it in Microsoft Graph explorer, it works fine to create the shared Team's channel. I have checked all Permissions, and it should agree with what is documented in Microsoft docs: Channel.Create, Group.ReadWrite.All**, Directory.ReadWrite.All.

enter image description here

Upvotes: 0

Views: 1014

Answers (1)

Expiscornovus
Expiscornovus

Reputation: 1497

It might be the case of the @ character of @odata.type needs to be escaped. Can you try @@odata.type.

Btw, in the Microsoft Docs I don't see them mentioning the @odata.type property for the channel. So, you might be able to remove it.

Here is direct link to that code snippet: https://learn.microsoft.com/en-us/graph/api/channel-post?view=graph-rest-1.0&tabs=http#example-5-create-a-shared-channel-on-behalf-of-a-user

Can you try something like below to see if that works?
Change the user id to a user id from your tenant

{
"displayName": "PA Shared Channel",
"description": "This is my first shared channel",
"membershipType": "shared",
"members": [
    {
        "@@odata.type": "#microsoft.graph.aadUserConversationMember",
        "[email protected]": "https://graph.microsoft.com/v1.0/users('242a8004-6f04-4b80-9331-1661c63fea34')",
        "roles": [
            "owner"
        ]
    }
]

}

enter image description here

Upvotes: 0

Related Questions