Skip to content

Commit 2cdc268

Browse files
committedSep 4, 2022
Fixed encoding issue
1 parent ba505d2 commit 2cdc268

6 files changed

+49
-7
lines changed
 

‎GenerateInitialMapping.ps1

+9-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,15 @@ if ($null -eq $SOURCE_SITE_URL) {
88
}
99

1010
Write-Host "[Attention] Look for a login popup in a separate window. Please, log in to the source site site" -ForegroundColor Cyan
11-
Connect-PnPOnline -Url $SOURCE_SITE_URL -UseWebLogin -WarningAction Ignore
11+
12+
If($CLEAR_CREDENTIALS_CACHE){
13+
Connect-PnPOnline -Url $SOURCE_SITE_URL -SPOManagementShell -ClearTokenCache -WarningAction Ignore
14+
}else{
15+
Connect-PnPOnline -Url $SOURCE_SITE_URL -UseWebLogin -WarningAction Ignore
16+
}
17+
18+
19+
1220

1321
$lists = Get-PnPList -Includes Views, Fields, DefaultView
1422
$lists = $lists | Where-Object hidden -eq $false

‎MISC/Move-Lists.ps1

+5-2
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,11 @@ if ($MigrationType -eq "Export") {
6565
}
6666

6767
# Remove all Property Bag entries from the lists. Begin
68-
((Get-Content -path Lists.xml -Raw) -replace '<\?xml version="1.0"\?>','' -replace 'RootSite', 'Web') | Set-Content -Path Lists.xml
68+
((Get-Content -path Lists.xml -Raw -Encoding UTF8) -replace '<\?xml version="1.0"\?>','' -replace 'RootSite', 'Web') | Set-Content -Path Lists.xml -Encoding UTF8
6969

7070
$xml = [xml](Get-Content Lists.xml)
71+
72+
7173
$propertyBagEntries = $xml.GetElementsByTagName('pnp:PropertyBagEntries')
7274
if($propertyBagEntries -ne $null -and $propertyBagEntries.Count -gt 0) {
7375
for ($i = $propertyBagEntries.Count -1; $i -gt -1 ; $i--) {
@@ -76,7 +78,8 @@ if ($MigrationType -eq "Export") {
7678
}
7779

7880
$xml.Save('Lists.xml')
79-
"<?xml version=""1.0""?>`n" + (Get-Content "Lists.xml" -Raw) | Set-Content "Lists.xml"
81+
"<?xml version=""1.0""?>`n" + (Get-Content "Lists.xml" -Raw -Encoding UTF8) | Set-Content "Lists.xml" -Encoding UTF8
82+
8083
# Remove all Property Bag entries from the lists. End
8184

8285
foreach ($title in $titles) {

‎MISC/PS-Forms.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ function Get-FormItemProperties {
603603

604604

605605
$Form = New-Object System.Windows.Forms.Form
606-
$Form.Height = 380
606+
$Form.Height = 450
607607
$Form.Width = 530
608608
$Form.Text = $dialogTitle
609609
$Form.Topmost = $true

‎Prepare-Deployment-Package-for-Client.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Import-Module (Get-ChildItem -Recurse -Filter "*.psd1").FullName -DisableNameChe
3737

3838
$Migration = @{
3939
SOURCE_SITE_URL = "https://contoso.sharepoint.com/sites/Site_A"
40-
MIGRATE_LISTS = $true
40+
MIGRATE_LISTS = $true
4141
}
4242

4343
$Migration = Get-FormItemProperties `

‎README.md

+13
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,19 @@ SharePoint List forms customized with Power Apps can be migrated if you follow t
166166

167167
# Latest Updates
168168

169+
### 3.8 Version - 2022-09-04
170+
171+
#### New features
172+
- Added ability to Clear Credentials cache (useful when your credentials pop-up opens and closes automatically, without prompting you to enter your credentials)
173+
174+
#### Bug fixes
175+
- Fixed an issue with migrating between non-English SharePoint sites.
176+
177+
#### Known issues
178+
- Migrated lists with custom content types end up with extra content type that should be deleted manually.
179+
- Migrated lists might need fields to be added to the content type or a form.
180+
181+
169182
### 3.7 Version - 2022-09-01
170183

171184
#### New features

‎RunAllScripts.ps1

+20-2
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ $Migration = @{
3838
SOURCE_SITE_URL = "https://contoso.sharepoint.com/sites/Site_A"
3939
TARGET_SITE_URL = "https://contoso.sharepoint.com/sites/Site_b"
4040
MIGRATE_LISTS = $true
41+
CLEAR_CREDENTIALS_CACHE = $false
4142
}
4243

4344
$Migration = Get-FormItemProperties `
4445
-item $Migration `
4546
-dialogTitle "Enter source and target sites" `
46-
-propertiesOrder @("SOURCE_SITE_URL", "TARGET_SITE_URL", "MIGRATE_LISTS")
47+
-propertiesOrder @("SOURCE_SITE_URL", "TARGET_SITE_URL", "MIGRATE_LISTS", "CLEAR_CREDENTIALS_CACHE")
4748

4849
$SOURCE_SITE_URL = $Migration.SOURCE_SITE_URL
4950
$TARGET_SITE_URL = $Migration.TARGET_SITE_URL
@@ -58,13 +59,30 @@ else {
5859
}
5960
$MIGRATE_LISTS = $Migration.MIGRATE_LISTS
6061

62+
63+
if ($Migration.CLEAR_CREDENTIALS_CACHE -like "true" -or
64+
$Migration.CLEAR_CREDENTIALS_CACHE -like "yes" -or
65+
$Migration.CLEAR_CREDENTIALS_CACHE -like "1"
66+
) {
67+
$Migration.CLEAR_CREDENTIALS_CACHE = $true
68+
}
69+
else {
70+
$Migration.CLEAR_CREDENTIALS_CACHE = $false
71+
}
72+
$MIGRATE_LISTS = $Migration.CLEAR_CREDENTIALS_CACHE
73+
6174
. .\GenerateInitialMapping.ps1
6275
if ($MIGRATE_LISTS) {
6376
. .\MISC\Move-Lists.ps1 -Path $Path -MigrationType Export -SourceSite $SOURCE_SITE_URL
6477
}
6578

6679
Write-Host "[Attention] Look for a login popup in a separate window. Please, log in to the target site." -ForegroundColor Cyan
67-
Connect-PnPOnline -Url $TARGET_SITE_URL -UseWebLogin -WarningAction Ignore
80+
If($CLEAR_CREDENTIALS_CACHE){
81+
Connect-PnPOnline -Url $TARGET_SITE_URL -SPOManagementShell -ClearTokenCache -WarningAction Ignore
82+
}else{
83+
Connect-PnPOnline -Url $TARGET_SITE_URL -UseWebLogin -WarningAction Ignore
84+
}
85+
6886

6987
if ($MIGRATE_LISTS) {
7088
Write-Host Applying Imported XML to $TARGET_SITE_URL -ForegroundColor Cyan

0 commit comments

Comments
 (0)