web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to get image in th...
Power Automate
Answered

How to get image in the body of channel message Ms Teams?

(0) ShareShare
ReportReport
Posted on by

How to copy all images and attachments in Ms Teams Channel Message body then save to specific folder in Sharepoint.

Categories:
I have the same question (0)
  • Verified answer
    v-yetonggu-msft Profile Picture
    Microsoft Employee on at

    Hi @wachid ,

    In MS Teams, if you upload files or pictures, they will be automatically saved to the dedicated SharePoint folder of the Teams Channel, so we need to get the paths of these files and then save them to the specific folder of SharePoint.

    I did a test for your reference.

    In my scenario:

    vyetonggumsft_0-1699598973838.png

    vyetonggumsft_3-1699600027746.png

     

    items('Apply_to_each')['name']

     

    My Teams Channel:

    vyetonggumsft_0-1699599762739.png

    Files automatically saved to this Teams channel:

    vyetonggumsft_6-1699600324429.png

    Save files in specific folder:

    vyetonggumsft_7-1699600348374.png

    Best Regards,

    Sunshine Gu

     

  • Manish Solanki Profile Picture
    15,169 Moderator on at

    Hi @wachid 

     

    I have a sample flow for you.

     

    1. Create an automate flow & choose the trigger as 'When a new channel message is added'. Set the team & channel as per your need:

    ManishSolanki_0-1699598371643.png

     

    2. Next, add "Apply to each" action to iterate the attachments in the message. Pass the 'Message attachments' from the dynamic content as shown below:

    ManishSolanki_1-1699598532279.png

     

    3. Now, inside apply to each block add 'Get files (properties only)' action. In the site URL set the teams site where message is sent. Similarly, set the source team channel folder in 'Limit Entries to Folder' where messages are being posted:

    ManishSolanki_2-1699598785029.png

    In the above action, set:

    Site Address: <source team site url where messages are being posted>

    Library Name: Documents

    Limit Entries to Folder: <source channel folder where messages are being posted>

    Filter Query: FileLeafRef eq '@{items('Apply_to_each')?['name']}'

     

    Next, add another "Apply to each" action and pass the value object from get files to it:

    ManishSolanki_3-1699599824378.png

    Inside "Apply to each 2" action, add copy file action to copy the attachment to desired folder:

    ManishSolanki_4-1699599953179.png

    Set the source site URL & document library of the team site where messages are being posted. Set the destination site & folder as per your need.

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

    Thanks

     

  • wachid Profile Picture
    on at
    flow not work when i post image in ms team using "paste from clipboard"
  • v-yetonggu-msft Profile Picture
    Microsoft Employee on at

    Hi @wachid ï¼Œ

    Because the image in the clipboard is not recognized as an attachment, it is just an image inserted into the body of the text.

    vyetonggumsft_1-1699851695917.png

    I recommend that you save the image locally and insert it as an attachment into the body of the Teams Channel.

    vyetonggumsft_2-1699851936223.png

    Best Regards,

    Sunshine Gu

  • wachid Profile Picture
    on at

    does that mean the image in the Body cannot be copied to the specified sharepoint folder?

  • wachid Profile Picture
    on at

    thank you so much

  • v-yetonggu-msft Profile Picture
    Microsoft Employee on at

    Hi @wachid ,

    Yes, you have to convert the images in the text to files.

     

    Best Regards,

    Sunshine Gu

  • v-yetonggu-msft Profile Picture
    Microsoft Employee on at

    Hi @wachid ,

    Steps to save clipboard pictures locally:

    vyetonggumsft_6-1699867272340.png

    vyetonggumsft_9-1699867430737.png

    vyetonggumsft_8-1699867321243.png

    Best Regards,

    Sunshine Gu

  • antongovorushki Profile Picture
    2 on at
    The issue arises when checking the loop "InvalidTemplate'. Message: 'The template validation failed: 'The repetition action(s) 'Apply_to_each' referenced by 'inputs' in action 'Create' are not defined in the template''. Can you please advise on what the problem might be?" ."
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 382

#2
Valantis Profile Picture

Valantis 370

#3
David_MA Profile Picture

David_MA 300 Super User 2026 Season 1

Last 30 days Overall leaderboard