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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Copy SharePoint List f...
Power Automate
Unanswered

Copy SharePoint List from one site to another (not just items)

(0) ShareShare
ReportReport
Posted on by 124

Hi, 

I am struggling solving this problem. 

 

I need to copy a SharePoint List from one SharePoint site to another SharePoint site. List settings as "no attachments" should be applied to the new list as well as all columns and formatting. There are no items in source list. 

 

On my way to solve this I learned to get a Graph API access token and how to successfully create a list with Graph API. 

PhilFancy_0-1675848015364.png

But I cannot find a way to get information about the source list by Graph API so I could use my knowledge about POST /lists to create it this way. 

Maybe there is a different approach to copy a list in Power Automate. 
Would be great to hear your ideas. 

Categories:
I have the same question (0)
  • grantjenkins Profile Picture
    11,063 Moderator on at

    Is this just a one-off task - copy the list to another site just the once?

     

    If so, then you can just go to the destination site in SharePoint and create a new list based off an existing list using your source list. This will copy all the columns, views, formatting, etc. It won't copy any items which you mentioned you don't have anyway.

     

    grantjenkins_1-1675854998973.png

     

    However, if you needed to repeat this process via Power Automate, then let us know.


    ----------------------------------------------------------------------
    If I've answered your question, please mark the post as Solved.
    If you like my response, please consider giving it a Thumbs Up.

  • PhilFancy Profile Picture
    124 on at

    Thank you for your response. I need to accomplish this in Power Automate. 

     

  • PhilFancy Profile Picture
    124 on at

    @grantjenkins wrote:

    However, if you needed to repeat this process via Power Automate, then let us know.

     


    I need to repeat this process via Power Automate. Do you have any idea how to resolve this? 

     

  • PhilFancy Profile Picture
    124 on at

    Last push in hope to get some support.

     

    In the meantime I tried to generate a list via Graph API https://graph.microsoft.com/v1.0/sites/[id]/lists. This works pretty good but with some downsides. 

    • JSON formatting of the columns is lost
    • List settings as "no attachments" are lost

    Here a screenshot for all that discover this thread in the future as a first attempt how it should look: 

    PhilFancy_0-1676364724723.png

    As mentioned above, I hope there is someone coming up with an attempt how to copy a SharePoint list with JSON formatting and list settings. 

     

  • Verified answer
    PhilFancy Profile Picture
    124 on at

    I got the solution! 

    As I could not find a way doing this in Graph API I looked around and took the obvious approach -> PowerShell. 

    But my first attempt was complicated. -> Power Automate (via On Premise Data Gateway Server) calls a SQL Stored Procedure I created on a on prem SQL Server which runs a SSIS package on this on prem SQL Server which called a PowerShell script that copied the SharePoint list from one site to another. 

     

    That worked, but was too complicated. After some digging and testing here is a working solution via Azure Automation: 

     

    Steps are:

    1. Create Azure Automation Ressource (steps described here)
    2. Add PnP.PowerShell Module to Automation Ressource
      1. Export it from your PowerShell ISE-> 
        save-module -Name PnP.PowerShell -Path c:\temp\
      2. Create a zip from the exported folder
      3. Import it to "Modules" of your Azure Automation Ressource
    3. Add Credential for user to run the PowerShell script
      1. In Azure Automation Ressouce go to Credentials -> add user/password and copy name (mine was "SPOAdminCred")
    4. Create Runbook
      1. Select PowerShell Workflow (that makes it accessable from Power Automate with parameters)
      2. Add PowerShell script with parameters and reference to credentials (e.g. "SPOAdminCred")
        workflow SPO-CopyList

        {

            # Dynamic Parameters

            param(

            [parameter(Mandatory=$false)]

            [string]$SourceSiteURL = "https://TENANT.sharepoint.com/sites/TemplatePMODevelopment",

            [parameter(Mandatory=$false)]

            [string]$SourceListURL = "https://TENANT.sharepoint.com/sites/TemplatePMODevelopment/Lists/Risks",

            [parameter(Mandatory=$false)]

            [string]$DestinationWebUrl = "https://TENANT.sharepoint.com/sites/DETeamsDemo",

            [parameter(Mandatory=$false)]

            [string]$NewListTitle = "RisksNewList"

            )

            # Connection

            $CrescentCred = Get-AutomationPSCredential -Name "SPOAdminCred"

            Connect-PnPOnline -Url $SourceSiteURL -Credentials $CrescentCred    

            Copy-PnPList -SourceListUrl $SourceListURL -DestinationWebUrl $DestinationWebUrl -Title $NewListTitle

            Disconnect-PnPOnline

        }
      3.  Press Save and Publish (note - if you press publish it will not save and will publish empty script)
    5. Make sure the user from Power Automate is allowed to launch runbook and read ressource group
    6. Make Power Automate run the runbook
      1. Add "Azure Automation" "Create Job" in Power Automate, select Subscription, Resource Group, Automation Ressource, Runbook and fill the parameters.
        PhilFancy_0-1677072894225.png

         

      2. Run Flow and enjoy!


    I am glad I solved this and hope this helps anyone else in the future.
    Would be great to get some thumbs up. Cheers!


     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard