Copy-PorteoFolders.ps1
<# .Synopsis Copy-PorteoFolder -FolderName "NameOfFolder" -SrcConnection $srcConn -DestConnection $dstConn .Description This function copies the Sharepoint folder specified by the `-Folder` argument. It copies the folder from the site specified by `-SrcConnection` argument and copies the Folder to the destination site specified by the `-DestConnection argument. .Example $srcSite = "https://client1.sharepoint.com/sites/BaseSite" $dstSite = "https://client2.sharepoint.com/sites/NewSite" $srcCreds = Get-Credential $dstCreds = Get-Credential $srcConn = Connect-PnPOnline -Url $srcSite -Credentials $srcCreds $dstConn = Connect-PnPOnline -Url $dstSite -Credentials $dstCreds Copy-PorteoFolder -FolderName "NameOfFolder" -SrcConnection $srcConn -DestConnection $dstConn #> function Copy-PorteoFolder { param( $folderName, $srcConnection = (Get-PnPConnection), $destConnection = (Get-PnPConnection) ) Copy-SSPFiles -SrcFolder $folderName -DestFolder $folderName -SrcConnection $srcConnection -DestConnection $destConnection } <# .Synopsis Copy-PorteoFolders -FolderNames ("Folder1", "Folder2", "Folder3") -SrcConnection $srcConn -DestConnection $dstConn .Description This function copies the Folders specified by the -FolderNames argument and copies them from the site specified by the `-SrcConnection` argument and copies the Folder to the destination site specified by the `-DestConnection argument. If the folder names are not specified, then the folders to be copied are the default folders for a *Porteo* site, which are ***SiteAssets***, and ***Shared Documents***. .Example $srcSite = "https://client1.sharepoint.com/sites/BaseSite" $dstSite = "https://client2.sharepoint.com/sites/NewSite" $srcCreds = Get-Credential $dstCreds = Get-Credential $srcConn = Connect-PnPOnline -Url $srcSite -Credentials $srcCreds $dstConn = Connect-PnPOnline -Url $dstSite -Credentials $dstCreds Copy-PorteoFolders -FolderNames ("Folder1", "Folder2", "Folder3") -SrcConnection $srcConn -DestConnection $dstConn #> function Copy-PorteoFolders { param( $folderNames, $srcConnection = (Get-PnPConnection), $destConnection = (Get-PnPConnection) ) if (-not $folderNames) { $folderNames = ("SiteAssets", "Shared Documents") } foreach ($folder in $folderNames) { Copy-PorteoFolder -Folder $folder -SrcConnection $srcConnection -DestConnection $destConnection } } |