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

Create MS Teams Group Chat using CC in email(Office365)

Hello everyone. Just getting into PowerAutomate and am trying to figure out how to send a Teams group chat message to everyone in the CC line of an email.  The top item is "When a new email arrives (V3)." If I manually enter a "Members to add" with "userID@domain.com" the group chat is created successfully and message sent. Manually entering these though defeats the purpose of what I am trying to do. I was hoping that the dynamic "CC" field from the first step would just pull over, which it will but by email address and that will not create a Teams Group Chat and it will fail. I then attempted to use the "Get User Profile (V2)" and then dynamically pull "User Principle Name," but that will only get one "UserID@domain.com" and none of the emails past the first. I can't be the first person to want to do something like this and I'm betting there is a simpler way. Any help would be very appreciated. Thanks!

 

TestforSend.jpg

1 ACCEPTED SOLUTION

Accepted Solutions
WillPage
Solution Sage
Solution Sage

I see it says you can use email addresses or IDs. Is it failing on email addresses because one or more the email addresses is not in your tenancy?

If they all are and it's failing anyway (wouldn't surprise me to find a bug in PA) then you can do this:

 

1. Initialise an array variable.

2. Add a compose and put the expression split(triggerOutputs()?['body/ccRecipients'],';') in there

3. Add a Filter array action with its input being the output from step 2 and the advanced mode condition being @endswith(item(), 'mydomain.com') where mydomain.com is your internal domain name. This is to filter out external people who you can't start a group chat with

4. Add an Apply to each using the output of the Filter array action as its input

5. Inside the Apply to each add a Get User Profile (V2) action using the Current item from dynamic content (or items('Apply_to_each') as an expression if it's not there)

6. Still in the Apply to each, go Append to array variable and append the id dynamic content from the action above

7. After the Apply to each loop, add a Join action and join the array variable on a semicolon character

8. Use the output of the Join in your Teams action.

 

View solution in original post

3 REPLIES 3
WillPage
Solution Sage
Solution Sage

I see it says you can use email addresses or IDs. Is it failing on email addresses because one or more the email addresses is not in your tenancy?

If they all are and it's failing anyway (wouldn't surprise me to find a bug in PA) then you can do this:

 

1. Initialise an array variable.

2. Add a compose and put the expression split(triggerOutputs()?['body/ccRecipients'],';') in there

3. Add a Filter array action with its input being the output from step 2 and the advanced mode condition being @endswith(item(), 'mydomain.com') where mydomain.com is your internal domain name. This is to filter out external people who you can't start a group chat with

4. Add an Apply to each using the output of the Filter array action as its input

5. Inside the Apply to each add a Get User Profile (V2) action using the Current item from dynamic content (or items('Apply_to_each') as an expression if it's not there)

6. Still in the Apply to each, go Append to array variable and append the id dynamic content from the action above

7. After the Apply to each loop, add a Join action and join the array variable on a semicolon character

8. Use the output of the Join in your Teams action.

 

Jflora
Frequent Visitor

@WillPage - Thank you! So far so good here!  I did take out #3 only because the email input into the (When a new email arrives (V3)) will only ever be an internal email to our corporation. Now that I think about it though, if they ever change that, it would be dynamic and the PA would still run, so I may add it back in.

 

Thank you so much for stating this in a way that, after a little bit of digging helped me figure this out. I am very green with PA but I can definitely see its potential.

ERIC_A
Frequent Visitor

Update

I found my issue. I made a mistake and I didn't initialize the variable as step 1 stated. my bad 

 

 

hi,

Step 6 has an issue. I cannot select any name on the Name field but not sure why. According to other cases the variable is not initialized but I followed the steps you mentioned above so I am thinking a SW upgrade or a code requirement changed causing my error ?

ERIC_A_0-1664575397351.png

 

 

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events happening this month - don't miss out!

 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

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

Users online (5,001)