Copy-PorteoLists.ps1



function Copy-PorteoList {
    param(
        $listName,
        $srcConnection = (Get-PnPConnection),
        $destConnection = (Get-PnPConnection)
    )
    $data = Get-SSPListData -ListName $listName -Connection $destConnection
    if (-not $data -or $data.length -eq 0) {
        Copy-SSPList -ListName $listName -SrcConnection $srcConnection -DestConnection $destConnection
    } else {
        Write-Host "No Data for $listName, no copy"
    }
}

function Copy-PorteoLists {
    param(
        $listNames,
        $srcConnection = (Get-PnPConnection),
        $destConnection = (Get-PnPConnection)
    )

    if (-not $listNames) {
        $listNames = ("Journal", "Links", "Requests")
    }
    foreach ($listName in $listNames) {
        Copy-PorteoList -ListName $listName -SrcConnection $srcConnection -DestConnection $destConnection
    }
}