Power Automate copy list item to another list with attachments

In this Power Automate or Microsoft flow tutorial, we will discuss how to copy items from one sharepoint list to another using Power Automate. We will see two examples on power automate copy list item to another list with attachments and power automate copy sharepoint list item to another list.

Power Automate copy list item to another list with attachments

Now, we will see an example of how to copy list items to another list with attachments using Power Automate. Here we will move items from one SharePoint list to another list based on conditions using Power Automate.

Here, I have created two SharePoint lists. One is the source list, another one is the destination list.

The SharePoint source list consists of the below columns:

Columns Type
ID (default) Number
Title (default) Single line column
Assigned To Person or Group
Task Status Choice
Start Date Date and Time
End Date Date and Time
Developer Comments Multiple lines of text  

And the SharePoint list with some data looks like below:

power automate copy list item to another list
SharePoint Source List with Some Data

Similarly, I have created another SharePoint list i.e. destination list having the same column names and types like below:

copy items from one sharepoint list to another
Destination SharePoint list

Here is the requirement.

  • We want to copy items from one SharePoint list to another list using Power Automate.
  • It should copy the items whose title contains a specific string “PostgreSQL”. It should not copy or move the other items.
  • While copying or moving the list items, it should also move or copy the SharePoint list item attachments.

Here, we will first create the item in the destination list and then delete the item from the source list. There is no way, we can directly move all the specified items from one list to another list using Power Automate or Microsoft flow.

Now, let us create the flow.

Step-1:

Go to https://flow.microsoft.com, then click on + Create -> Instant cloud flow -> choose Manually trigger a flow -> Create.

Microsoft flow copy sharepoint list item to another list
Microsoft flow copy sharepoint list item to another list

Now, the flow got created and we will add the flow actions to first create the items with attachments in the destination lists.

Step-2:

Now, we will add a new action to get all the items from the SharePoint source list. For this, we are going to use the Get items Microsoft flow action.

If you are new to flow or Power automate and want to know how to use the Get Items flow action, then check out, Power Automate get items examples.

To add this flow action, go to Next step -> search for Get items (under SharePoint) in the search bar > click on that.

Here select the SharePoint Site Address and then the List Name. Here choose the SharePoint Souce list from where you want to copy the list items.

power automate copy sharepoint list item to another list
Power Automate copy sharepoint list item to another list

Note:

As per our requirement, we need to get the contents whose Title contains PostgreSQL, but we can not use the Filter query in the Get Items workflow action, because contains is not supported in Get items. Here instead of contains, we will check if Title contains like below.

Step-3:

Now, let us see, how to get all the attachments for all items based on the item id from the SharePoint source list.

For this, click on +Next step -> search for Get Attachments (under SharePoint). Here, set the Site Address and the list name (Source list). In the Id, we will use the ID from the Get items.

We can see it will create an Apply to each loop so that it can navigate all the items from the collection or list like below:

power automate copy list item to another list with attachments
Power automate copy list item to another list with attachments

Read Power Automate email body formatting

Step-4:

Now, we will see, how to filter items, based on the Title contains “a specified string”.

Then, we will add a condition action under the Get attachments (inside the loop) to check whether the Title field contains PostgreSQL‘ or not.

We have used the ‘Or’ operator to check every possible string ‘postgreSql’ in the Title field as it is case-sensitive. Check out the screenshot below:

power automate move sharepoint list item to another list
Power automate move sharepoint list item to another list

Step-5:

If the condition will satisfy, then it will create a new item in the destination SharePoint list. If the condition does not satisfy, then we are not doing anything.

Now, inside the ‘If yes’, we will add an action to create the filtered items ( having ‘PostgreSQL’ in the title field) in the destination list i.e. PostgreSQLTask.

For this, click on the Add an action (inside the If yes section) > select Create item (SharePoint). Here, we have to set the Site address and the destination list name.

It will also show all the fields of that list and here we will set all the fields from ‘Get items‘.

move SharePoint list items with attachments in Power Automate based on condition
move SharePoint list items with attachments in Power Automate based on condition

Also, read How to use Rest API in Power Automate

Step-6:

Next, we will add another action to get the attachment’s content from the source SharePoint list. This action is used to return the file’s content using the file identifier.

So, under the Create Item, click on + add an action > select Get attachment content. Here we will set the site address along with the source list name. In ID, we will insert the ID from the Get items and in the file identifier where we will insert the id from the Get attachment content.

We can see it will also create an Apply to each loop after using id.

power automate copy list item to another list with attachments
Power automate copy list item to another list with attachments

Step-7:

After getting the attachment contents, now we will add another action ‘Add attachment‘ inside that loop (under the Get attachment content) that will add a new attachment to the specified list item on the destination SharePoint list.

Similarly, here we will set the site address and the destination list name. Also,

  • In Id ID from create item
  • In File nameDisplayName from get attchments
  • In File Content Attachment content from Get attachment content
power automate move sharepoint list item to another list
Move List Item from one list to another for selected item using Power Automate

Step-8:

Finally, we will add an action outside of this loop to delete the items from the source list as it is created on the destination SharePoint list.

Click on the add an action and search for the Delete item under SharePoint. Set the site address and the name of the Destination list. In Id, we will use the ID from the Get items.

power automate copy list item to another list with attachments
Move List Item from one list to another for selected item using Flow

Now we can see our Microsoft flow is ready to test and run. Click on the Run button to run the automated flow.

We can see after running the flow, the selected items move from the DemoPostgreSQL to PostgreSQLTask.

microsoft flow move items from one list to another
Microsoft flow move items from one list to another

Also, these selected items have been deleted from the source list i.e. DemoPostgreSQL.

power automate copy item to another list
power automate copy list item to another list with attachments

This is how we can move items with attachments from one SharePoint list to another in Power Automate based on conditions.

This is how to copy list item to another list with attachments using Power Automate.

Download power automate copy list item to another list with attachments from here.

This is how to move sharepoint list item to another list in Power Automate.

Power automate copy SharePoint list item to another list

Let us see another example of power automate copy sharepoint list item to another list.

By using this below example, I will show you how to copy items from one list to another list from one SharePoint site to another SharePoint Site using the Microsoft flow template.

Here I have two SharePoint Online List as “SharePoint Book Order Details” which is present in the Source Site. And another SharePoint Online List is “SharePoint Book Order” which is present in the Destination Site.

Both SharePoint lists are having the same data types of Columns with the same Column name. You can see one of the below SharePoint Online List which is present in the Source Site.

microsoft flow copy list items to another list
Microsoft flow copy list items to another list

Both the SharePoint Source List and Destination List is having below different data types of columns as:

  • Title (By default) (Single line of text)
  • Book Name (Single line of text)
  • Book Price (Currency)
  • Quantity (Number)
microsoft flow copy list items to another list
Microsoft flow copy list items to another list

The below screenshot represents the other list (SharePoint Book Orders) that is present in the Destination Site.

sharepoint copy list item to another list flow
sharepoint copy list item to another list flow

Read Power Automate If expression

Microsoft flow copy list items to another list

Here, I will show you how we can copy all the items from one SharePoint List (Source Site) to another SharePoint List (Destination Site) using Microsoft Flow.

You can view the below screenshot which represents the whole structure of Microsoft Flow. Follow the below descriptions about all templates which I have used in this Microsoft Flow.

power automate copy list item to another list
power automate copy list item to another list

When an item is created or modified:

  • Site Address: Provide the SharePoint Site address URL of Source Site.
  • List Name: Specify the name of the SharePoint List of the source site. As in this example, I have taken my Source site SharePoint List as “SharePoint Book Order Details“.
copy items from one sharepoint list to another
copy items from one sharepoint list to another

Get items:

  • Site Address: Provide the SharePoint Site address URL of Destination Site.
  • List Name: Specify the name of the SharePoint List of the destination site. As in this example, I have taken my Destination site SharePoint List as “SharePoint Book Orders“.
  • Filter Query: This field helps you to match the Titles of the rows of the Source. For matching the Titles, you can write as Title eq ‘(select Title from Dynamic content)‘.

NOTE:

1. It is not necessary to take the Title column always. You can take any column which you want to map between source list and destination list, But the column name should be same in the both of the lists.
2. For example, if you have columns for the First Name and Last Name in the source list, and a column for Full name in the destination list, you could type: FullName eq ‘[First name] [Last name]’.
3. You need to sure that the Dynamic content Title value should be present within the single quote, Otherwise, you may face the flow issue.
microsoft flow copy list item to another list
Microsoft flow copy list item to another list

Condition to check if the Item exists:

Now you have to take a condition action where it will check whether the item is present inside the Destination List or not. Then put the condition as like below:

equals(length(body(‘Get_items’)?[‘value’]), 0) is equal to true

microsoft flow copy sharepoint list item to another list
copy list item to another list Microsoft flow

You can follow the below screenshot of Condition action. This condition will be displayed as shown in below.

power automate copy items from one list to another
copy list item to another list in Microsoft flow

If Condition Exists:

If the above condition is satisfied, then add a “Create item” action in the “yes” branch which is having the below fields:

  • Site Address: Provide the Site address URL of Destination Site where the item will create.
  • List Name: Specify the name of the destination list where the item will create.
  • Title: Take the title field column value from the Dynamic content of source list as “when an item is created or modified“.

In the same way of Title field, take rest all the field column value from the
Dynamic content of source list as “when an item is created or modified“.

copy sharepoint list items to another list
copy list item to another list using microsoft flow

If Condition does not Exist:

If the above condition is not satisfied, then add an “Update item” action in the “no” branch which is having the below fields:

  • Site Address: Provide the Site address URL of Destination Site where the item will update.
  • List Name: Specify the name of the destination list where the item will update.
  • Id: Make sure that you need to take the Id field column value from the Dynamic content of “Get items“. While you add the Id from Get items, then an “Apply to each” action will be added automatically on the top of the action.
  • Title: Take the title field column value from the Dynamic content of source list as “when an item is created or modified“.

In the same way of Title field, take rest all the field column value from the
Dynamic content of source list as “when an item is created or modified“.

Once the flow will complete, just “Save” and “Test” it.

power automate copy list item to another list with attachments
Microsoft flow copy sharepoint list item to another list

To test the flow, you need to create or modify the SharePoint list item, then only the flow will trigger. To test my flow, I have created a new item in the source list (SharePoint Book Order Details) which you can see in the below screenshot.

copy data from one sharepoint list to another
How to copy list item to another list using Microsoft flow

After a while, when you will visit the Microsoft flow again, then you can get a successful status message as “Your flow ran successfully“.

power automate move sharepoint list item to another list
How to copy list item to another list using Microsoft flow

Now go to the Destination Site (SharePoint Book Orders) List, You can see that your item will be copied from the Source List (SharePoint Book Order Details). You can see that in the below screenshot.

microsoft flow move items from one list to another
How to copy list item to another list in Microsoft flow

You may like the following Microsoft flow tutorials:

In this flow tutorial, we have seen a few examples of power automate copy list item to another list with attachments. It covers:

  • power automate copy list item to another list
  • microsoft flow copy sharepoint list item to another list
  • power automate copy item to another list
  • power automate copy items from one list to another
  • power automate move sharepoint list item to another list
  • I am having issues as my column is called Region Name with a space between. The flow keeps failing on this as it may be considering this to be two different columns. I noticed that you stated above “2. For example, if you have columns for the First Name and Last Name in the source list, and a column for Full name in the destination list, you could type: FullName eq ‘[First name] [Last name]’.”
    You have a column for Full name but in the statement you put FullName with no space. I tried this and it also failed. If there is a space in the column name, how do I specify this? The space is in both the source and destination and I’m not sure if the first part of the statement is referring to the source which I cannot change.

  • >