In this article, you will learn how to copy a list item from one SharePoint site collection list to another site collection list, using Azure Logic app.
The logic app helps in automating the data from one platform to another in several ways. Likewise, we can develop an app to copy the list items from one SharePoint site collection list to another site collection list, using Logic app.
In my previous article, I explained about integrating SharePoint list data with Twitter, using the Logic app.
Here, let us consider a scenario, where there are two similar lists (List A & List B) placed on different site collections at SharePoint Online (SiteA & SiteB). Whenever the user tries to create a new item on ListB, if similar data exists on ListA, then the item should be copied to ListB.
This can be accomplished, using Azure Logic app triggers and actions. Any logs can be easily monitored by admins on Azure portal.
Let us consider two similar columns, which are present on both site collection lists (Title & Body).
Microsoft Azure account with Logic app.SharePoint
Online portal with two site collections
Create a Logic app on Azure portal from the Enterprise Integration option under market place. Provide the necessary inputs. Currently, Logic app is available as a free subscription. Once created, select the app from the all resources option. Now, select Logic app designer from development tools. Click Blank app (explained in the previous article with the screenshots.)
Now, select a new action. Search for SharePoint on the designer Window and select when a new item is created option under triggers.
Provide the list B details, as shown below. The trigger will happen every 3 minutes.
Get Source Item
Click New step, select an action and search for SharePoint. Under actions, select SharePoint get items method.
Provide the list A details, as shown below.
Update if the item matches
Create a new step and add a condition. (The two snapshots given below are shown for matching the titles of the source and the destination items).
In the object name, add dynamic content. Select the title under “get items” section.
In the value text box, select add dynamic content. Select the title under “when a new item is created” section.
If the condition is fulfilled, the item will be copied. In the IF YES section, choose an action. Search for SharePoint and select update item.
Provide the ListB details in site URL, list name, Id and title text boxes. (Id and title values from “when a new item is created” object).
Field to be copied - Select the list B body field in the body text box. (Select body from “Get Items” object).
Now, save the app.
Let us take a look at the source list (ListA). It contains the title and body columns with some data.
Make sure the Logic app is running. Navigate to ListB and create new items with the titles. The snapshot given below shows the created values.
Wait for 3 minutes. Now, refresh the ListB and check the items. The screenshot given below shows the ListB values copied from ListA.
In this article, I discussed about moving the data from one SharePoint site to another, using Logic app.