Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Moving Files from SharePoint Library to Another with Met Conditions

(0) ShareShare
ReportReport
Posted on by 26

Hello

 

This is my first attempt with Power Automate (I'm more familiar with SharePoint Designer)...I am trying to create a flow that will move files from one library to another when a specific field is modified to show a specific value. Right now, the flow works in I manually add the file name but I want the flow to identify all files that meet the criteria and then move them all.

 

My flow currently looks like this:

KML_0-1709587036407.png

 

When I run the flow, I get an error on the Foreach:

KML_1-1709587196945.png

KML_2-1709587222951.png

The current code reads like this:

{
  "type": "Foreach",
  "foreach": "@triggerOutputs()?['body/value']",
  "actions": {
    "Condition": {
      "type": "If",
      "expression": {
        "equals": [
          "@items('Foreach')?['Status/Value']",
          "Signed & Sent"
        ]
      },
      "actions": {
        "Move_file": {
          "type": "OpenApiConnection",
          "inputs": {
            "parameters": {
              "dataset": "https://iconergyco.sharepoint.com/sites/Contracts",
              "parameters/sourceFileId": "@items('Foreach')?['ID']",
              "parameters/destinationDataset": "https://iconergyco.sharepoint.com/sites/Contracts",
              "parameters/destinationFolderPath": "/Archived Contracts",
              "parameters/nameConflictBehavior": 1
            },
            "host": {
              "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline",
              "connection": "shared_sharepointonline",
              "operationId": "MoveFileAsync"
            }
          },
          "metadata": {
            "%252fActive%2bContracts%252fAD12%2bREFERENCE%2b-%2bC9901-FY21%2bIconergy%2bLTD_Consultant%2bAgreement%2b(GPE)%2b-%2bFully%2bExecuted.pdf": "/Active Contracts/AD12 REFERENCE - C9901-FY21 Iconergy LTD_Consultant Agreement (GPE) - Fully Executed.pdf"
          }
        }
      },
      "else": {
        "actions": {}
      }
    }
  },
  "runAfter": {}
}

In Editing the Flow, the ForEach parameters doesn't provide any options. 

KML_3-1709587731209.png

What do I need to change in the Foreach parameter to make this flow work?

  • KML Profile Picture
    26 on at
    Re: Moving Files from SharePoint Library to Another with Met Conditions

    Can anyone provide more assistance or is more information necessary? 

  • KML Profile Picture
    26 on at
    Re: Moving Files from SharePoint Library to Another with Met Conditions

     Archived Contracts library is the destination once the file has been updated under Status to Signed & Sent not when it's created.

  • SudeepGhatakNZ Profile Picture
    14,381 Most Valuable Professional on at
    Re: Moving Files from SharePoint Library to Another with Met Conditions

    What library is the flow running on?

    From what I can see you have set up the Archived Contracts folder as your destination folder.

    So the documents are meant to be copied to this folder when they are created.

    Isn't that what you want?

     

  • KML Profile Picture
    26 on at
    Re: Moving Files from SharePoint Library to Another with Met Conditions

    Hello. I've made some progress in that the flow claims to be running successfully, but the files are not actually being moved. Here is the Move file set-up:

    KML_0-1709772645321.png

     

    Here is the Active Contracts library where the files should have been moved from:

    KML_1-1709772755319.png

     

     

  • KML Profile Picture
    26 on at
    Re: Moving Files from SharePoint Library to Another with Met Conditions

    That would be great. Perhaps sometime tomorrow?

  • SudeepGhatakNZ Profile Picture
    14,381 Most Valuable Professional on at
  • KML Profile Picture
    26 on at
    Re: Moving Files from SharePoint Library to Another with Met Conditions

    Can you please tell me how I'm referring the incorrect field? The field that should trigger the move is the Status field that shows as Signed & Sent on any given file. I've tried it without the library name before the identifier and received the same error message.

  • SudeepGhatakNZ Profile Picture
    14,381 Most Valuable Professional on at
    Re: Moving Files from SharePoint Library to Another with Met Conditions

    @KML ,

    I see you are still referring the incorrect field. Just add the Identifier in there.

    SudeepGhatakNZ_0-1709676395087.png

     

     

  • KML Profile Picture
    26 on at
    Re: Moving Files from SharePoint Library to Another with Met Conditions

    I found the Identifier field as you show above, and I added what I thought that field was looking for...

    Screenshot 2024-03-05 133909.png

    And although the Flow saves just fine and doesn't return an error, when I test it, I still receive a Bad Request.

    Screenshot 2024-03-05 134141.png

  • SudeepGhatakNZ Profile Picture
    14,381 Most Valuable Professional on at
    Re: Moving Files from SharePoint Library to Another with Met Conditions

    SudeepGhatakNZ_0-1709595606452.png

     

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June 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 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1