Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Unanswered

Copy files from OneDrive to SharePoint (only if name contains certain text)

(0) ShareShare
ReportReport
Posted on by

Hi, I have a flow that copies files from a OneDrive folder to SharePoint which works (first pic), but I only want it to copy files if they contain certain text in their name. I added a condition (second pic) but it didn't work. Where am I going wrong?

 

DEBS1644_0-1693497615501.png

DEBS1644_1-1693497727355.png

 

 

  • DEBS1644 Profile Picture
    on at
    Re: Copy files from OneDrive to SharePoint (only if name contains certain text)

    DEBS1644_0-1693564717687.png

     

  • ManishSolanki Profile Picture
    15,085 Super User 2025 Season 1 on at
    Re: Copy files from OneDrive to SharePoint (only if name contains certain text)

    Hi @DEBS1644 

     

    Could you pls share the screenshot of condition action along with expression in edit mode.

     

    Thanks

  • DEBS1644 Profile Picture
    on at
    Re: Copy files from OneDrive to SharePoint (only if name contains certain text)

    Hi, just tested it and got this error. The files are contained in subfolders, which worked without the expression, but obviously was returning all files. It seems it can't find the files in subfolders.

    DEBS1644_0-1693559204671.png

     

  • ManishSolanki Profile Picture
    15,085 Super User 2025 Season 1 on at
    Re: Copy files from OneDrive to SharePoint (only if name contains certain text)

    Hi @DEBS1644 

     

    You need to compare the file name by writing an expression in the condition action. Expressions are written in the expression box as highlighted in the below screenshot:

    ManishSolanki_0-1693499983157.png

    Expression used for left side operand:

    contains(triggerOutputs()?['headers/x-ms-file-name-encoded'],'ESG-SF116')

    Expression used for right side operand:

    true

     

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

     

    Thanks

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,670 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,011 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow