Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
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.

  • antongovorushki Profile Picture
    2 on at
    Re: How to get image in the body of channel message Ms Teams?
    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?" ."
     
     
  • v-yetonggu-msft Profile Picture
    on at
    Re: How to get image in the body of channel message Ms Teams?

    Hi @wachid ,

    Steps to save clipboard pictures locally:

    vyetonggumsft_6-1699867272340.png

    vyetonggumsft_9-1699867430737.png

    vyetonggumsft_8-1699867321243.png

    Best Regards,

    Sunshine Gu

  • v-yetonggu-msft Profile Picture
    on at
    Re: How to get image in the body of channel message Ms Teams?

    Hi @wachid ,

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

     

    Best Regards,

    Sunshine Gu

  • wachid Profile Picture
    on at
    Re: How to get image in the body of channel message Ms Teams?

    thank you so much

  • wachid Profile Picture
    on at
    Re: How to get image in the body of channel message Ms Teams?

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

  • v-yetonggu-msft Profile Picture
    on at
    Re: How to get image in the body of channel message Ms Teams?

    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
    Re: How to get image in the body of channel message Ms Teams?
    flow not work when i post image in ms team using "paste from clipboard"
  • ManishSolanki Profile Picture
    15,085 Super User 2025 Season 1 on at
    Re: How to get image in the body of channel message Ms Teams?

    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

     

  • Verified answer
    v-yetonggu-msft Profile Picture
    on at
    Re: How to get image in the body of channel message Ms Teams?

    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

     

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492