forked from Zerg00s/FlowPowerAppsMigrator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGenerateInitialMapping.ps1
More file actions
42 lines (35 loc) · 1.38 KB
/
GenerateInitialMapping.ps1
File metadata and controls
42 lines (35 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
[CmdletBinding()]
param (
[Parameter(Mandatory = $false)]
[string]$DestinationFolder = $null
)
if ($null -eq $SOURCE_SITE_URL) {
$SOURCE_SITE_URL = Read-Host "Enter the URL of the original (old) SharePoint site"
}
Write-Host "[Attention] Look for a login popup in a separate window. Please, log in to the source site site" -ForegroundColor Cyan
Connect-PnPOnline -Url $SOURCE_SITE_URL -UseWebLogin -WarningAction Ignore
$lists = Get-PnPList -Includes Views, Fields, DefaultView
$lists = $lists | Where-Object hidden -eq $false
$resources = @()
$line = "" | Select-Object resource, oldId, newId
$line.resource = "SiteUrl"
$line.oldId = $SOURCE_SITE_URL
$resources += $line
$lists | ForEach-Object {
$line = "" | Select-Object resource, oldId, newId
$line.resource = $_.RootFolder.ServerRelativeUrl.Replace($_.ParentWebUrl, "")
$line.oldId = $_.ID
$resources += $line
$line = "" | Select-Object resource, oldId, newId
$line.resource = $_.DefaultView.ServerRelativeUrl.Replace($_.ParentWebUrl, "")
$line.oldId = $_.DefaultView.ID
$resources += $line
}
if ($DestinationFolder) {
$destinationCsvPath = Join-Path $DestinationFolder "resourceMapping.csv"
}
else {
$destinationCsvPath = "resourceMapping.csv"
}
$resources | Export-Csv -Path $destinationCsvPath -NoTypeInformation
Write-Host Mapping file resourceMapping.csv is generated -ForegroundColor Green