cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dB4
Helper III
Helper III

Microsoft Teams - Channel logs Send to E-Mail

Hi All,

 

We have a Private channel within a Private Team, with several external members/guests.

Is there a way via MS Flow to send every 30 minutes - the new chat logs of a specific channel to a mail address?

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-litu-msft
Community Support
Community Support

Hi @dB4,

 

There are steps shown below:

1. Initialize an array variable named Attachments:

2. Then put the body of Filter query (previous reply shows) into the Apply to each action, then put the Message attachment into Apply to each action 2 body.

3. Cause the attachment content URL contains full URL of the attachment, so we should use split() function to remove the web site part of the URL, the "Westero" is my side name, you should enter your site name in here.

split(item()?['contentUrl'],'Westeros')[1]

4. After we get the file path at step 3, we should use Get file content by path to get the file content, and use Get file metadata action to get the file name by using the file path that converted into the URI code:

uriComponent(outputs('Compose'))

5. Then we get the file content and file name, the last thing we need to do is put them into the array variable:

{
  "Name": "@{body('Get_file_metadata')?['Name']}",
  "ContentBytes": "@{body('Get_file_content_using_path')}"
}

6. Then put the variable into the Email attachment field, we should switch the attachment mode to input entire array:

Annotation 2020-07-27 175815.jpg

 

Annotation 2020-07-27 175941.jpg

 

Annotation 2020-07-27 180008.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
v-litu-msft
Community Support
Community Support

Hi @dB4,

 

Yes, you could refer to the following steps:

1. Create a recurrence trigger runs every 30 minutes;

2. Get messages of the channel;

3. Filter array, get last 30 minutes messages;

4. Create HTML table to inserted in Email.

Annotation 2020-07-23 131815.jpg

 

Annotation 2020-07-23 131919.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Dear @v-litu-msft  Good day,

 

Thanks for your input, works like a charm!
Can we just get the logs as plain text on the body of the email instead of html?

v-litu-msft
Community Support
Community Support

Hi @dB4,

 

Yes, you could edit the return content in the Create HTML table action:

Annotation 2020-07-24 171221.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello @v-litu-msft  , i will try this afterwards.

Note that i utilized the ready template for Teams messages to Email, but i cannot get attachments to be shown in email.

Please check the below screenshots.

 

flow.PNGnotification_email.PNG

https://imgur.com/SMkH4or

https://imgur.com/KpGr01x

 

v-litu-msft
Community Support
Community Support

Hi @dB4,

 

The uploaded attachment is store in the library of SharePoint site belong to team, you could use the Get file content by using path action of SharePoint connector to get these file content, then add them into the email attachment field to send out.

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Dear @v-litu-msft 

Could you please elaborate further with the Flow details?

 

 

 

v-litu-msft
Community Support
Community Support

Hi @dB4,

 

There are steps shown below:

1. Initialize an array variable named Attachments:

2. Then put the body of Filter query (previous reply shows) into the Apply to each action, then put the Message attachment into Apply to each action 2 body.

3. Cause the attachment content URL contains full URL of the attachment, so we should use split() function to remove the web site part of the URL, the "Westero" is my side name, you should enter your site name in here.

split(item()?['contentUrl'],'Westeros')[1]

4. After we get the file path at step 3, we should use Get file content by path to get the file content, and use Get file metadata action to get the file name by using the file path that converted into the URI code:

uriComponent(outputs('Compose'))

5. Then we get the file content and file name, the last thing we need to do is put them into the array variable:

{
  "Name": "@{body('Get_file_metadata')?['Name']}",
  "ContentBytes": "@{body('Get_file_content_using_path')}"
}

6. Then put the variable into the Email attachment field, we should switch the attachment mode to input entire array:

Annotation 2020-07-27 175815.jpg

 

Annotation 2020-07-27 175941.jpg

 

Annotation 2020-07-27 180008.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

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.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (4,779)