Forum Discussion
Duplicate and update SharePoint list dynamically
Hello Experts,
I would like to get my SharePoint list duplicated(with content) and whenever there is a change or new record in the original list the duplicated list should get dynamically updated. Is this achievable ? If yes, can you please guide me how?
Thanks heaps!
In order to create replica of the list (Without data), you can use OOTB option shown in below screen shot:
In order to copy existing data from source to destination list you can use below PowerShell script to do so which uses PnP.PowerShell
You still need to update field names in below script according to your list.$sourceWebUrl = "https://contoso.sharepoint.com/sites/SourceSite" $destinationWebUrl = "https://contoso.sharepoint.com/sites/DestinationSite" #Connect to source site Connect-PnPOnline -Url $sourceWebUrl -Interactive $listName = "AssetTypeMaster" $fields = "AssetType", "Description", "AseetTypeDescription" #Retrieves items $listItems = Get-PnPListItem -List $listName -Fields $fields #Write lists item to other list #Connect to destination site Connect-PnPOnline -Url $destinationWebUrl -Interactive foreach($listItem in $listItems) { $itemValues = @{ "AssetType" = $listItem["AssetType"]; "Description" = $listItem["Description"]; "AseetTypeDescription" = $listItem["AseetTypeDescription"] } Add-PnPListItem -List $listName -Values $itemValues }For syncing of the data between these two lists, there is not OOTB way but you could use Power Automate to do so. Following is the reference link to do so.
- https://sharepains.com/2021/12/17/synchronize-two-data-sources-power-automate/
- https://tomriha.com/how-to-synchronise-two-sharepoint-lists-with-power-automate/
Hope it will helpful to you and if so then Please mark my response as Best Response & Like to help others in this community
2 Replies
- kalpeshvaghelaIron Contributor
In order to create replica of the list (Without data), you can use OOTB option shown in below screen shot:
In order to copy existing data from source to destination list you can use below PowerShell script to do so which uses PnP.PowerShell
You still need to update field names in below script according to your list.$sourceWebUrl = "https://contoso.sharepoint.com/sites/SourceSite" $destinationWebUrl = "https://contoso.sharepoint.com/sites/DestinationSite" #Connect to source site Connect-PnPOnline -Url $sourceWebUrl -Interactive $listName = "AssetTypeMaster" $fields = "AssetType", "Description", "AseetTypeDescription" #Retrieves items $listItems = Get-PnPListItem -List $listName -Fields $fields #Write lists item to other list #Connect to destination site Connect-PnPOnline -Url $destinationWebUrl -Interactive foreach($listItem in $listItems) { $itemValues = @{ "AssetType" = $listItem["AssetType"]; "Description" = $listItem["Description"]; "AseetTypeDescription" = $listItem["AseetTypeDescription"] } Add-PnPListItem -List $listName -Values $itemValues }For syncing of the data between these two lists, there is not OOTB way but you could use Power Automate to do so. Following is the reference link to do so.
- https://sharepains.com/2021/12/17/synchronize-two-data-sources-power-automate/
- https://tomriha.com/how-to-synchronise-two-sharepoint-lists-with-power-automate/
Hope it will helpful to you and if so then Please mark my response as Best Response & Like to help others in this community
- SuperUser19Copper Contributorkalpeshvaghela Excellent! Thank you so much for sharing this.