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

Community site session details

Session Id : CtQkUqsggDIArbB6kzL08T
Power Automate - Building Flows
Unanswered

Moving Files from SharePoint Library to Another with Met Conditions

Like (0) ShareShare
ReportReport
Posted on 4 Mar 2024 21:31:28 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?

I have the same question (0)
  • KML Profile Picture
    26 on 12 Mar 2024 at 23:21:58
    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 07 Mar 2024 at 16:26:52
    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 07 Mar 2024 at 01:02:08
    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 07 Mar 2024 at 00:57:23
    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 06 Mar 2024 at 00:02:04
    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 05 Mar 2024 at 23:48:06
  • KML Profile Picture
    26 on 05 Mar 2024 at 23:29:41
    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 05 Mar 2024 at 22:06:41
    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 05 Mar 2024 at 20:43:00
    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 04 Mar 2024 at 23:40:14
    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 786 Moderator

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 724 Super User 2025 Season 2

#3
stampcoin Profile Picture

stampcoin 290 Super User 2025 Season 2

Last 30 days Overall leaderboard
Loading started