Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit443d9e4

Browse files
committed
removing fields causing 0x80070005 (E_ACCESSDENIED) error
1 parent242d24c commit443d9e4

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

‎MISC/Move-Lists.ps1‎

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@ Get-ChildItem -Recurse | Unblock-File
3333
Import-Module (Get-ChildItem-Recurse-Filter"*.psd1").FullName-DisableNameChecking
3434

3535

36+
functionRemove-SiteFieldFromXml {
37+
param (
38+
[Parameter(Mandatory=$true)]
39+
[string]$fileName,
40+
41+
[Parameter(Mandatory=$true)]
42+
[string]$fieldName
43+
)
44+
45+
$fileContent=Get-Content$fileName
46+
$pattern="<Field .*Name=`"$fieldName`".*\/>"
47+
$updatedContent=$fileContent-replace$pattern,""
48+
Set-Content-Path$fileName-Value$updatedContent
49+
}
50+
3651
try {
3752
$lists=Get-PnPList
3853
}
@@ -81,7 +96,7 @@ if ($MigrationType -eq "Export") {
8196
$exportContentTypes=$true;
8297
}
8398
}
84-
}
99+
}
85100

86101
if ($exportContentTypes) {
87102
Get-PnPProvisioningTemplate-ListsToExtract$titles-Out"Lists.xml"-Handlers Lists, ContentTypes, Fields-Force-WarningAction Ignore
@@ -93,21 +108,23 @@ if ($MigrationType -eq "Export") {
93108
# Remove all Property Bag entries from the lists. Begin
94109
((Get-Content-Path Lists.xml-Raw-Encoding UTF8)-replace'<\?xml version="1.0"\?>',''-replace'RootSite','Web')|Set-Content-Path Lists.xml-Encoding UTF8
95110

111+
# Removing Site fields that cause the Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)
112+
Remove-SiteFieldFromXml-fileName"Lists.xml"-fieldName"TriggerFlowInfo"
113+
Remove-SiteFieldFromXml-fileName"Lists.xml"-fieldName"IsolatedDomain"
114+
96115
$xml= [xml](Get-Content Lists.xml)
97116

98-
99117
$propertyBagEntries=$xml.GetElementsByTagName('pnp:PropertyBagEntries')
100118
if ($propertyBagEntries-ne$null-and$propertyBagEntries.Count-gt0) {
101119
for ($i=$propertyBagEntries.Count-1;$i-gt-1 ;$i--) {
102120
$supress=$propertyBagEntries[$i].ParentNode.RemoveChild($propertyBagEntries[$i])
103-
}
121+
}
104122
}
105123

106124
$xml.Save('Lists.xml')
107125
"<?xml version=""1.0""?>`n"+ (Get-Content"Lists.xml"-Raw-Encoding UTF8)|Set-Content"Lists.xml"-Encoding UTF8
108126

109127
# Remove all Property Bag entries from the lists. End
110-
111128
foreach ($titlein$titles) {
112129
# Get the latest list item form layout. Footer, Header and the Body:
113130
$list=Get-PnPList$title-Includes ContentTypes
@@ -118,7 +135,6 @@ if ($MigrationType -eq "Export") {
118135

119136
if ($MigrationType-eq"Import") {
120137
Write-Host"Importing lists and libraries..."-ForegroundColor Yellow
121-
122138

123139
try {
124140
Apply-PnPProvisioningTemplate-Path Lists.xml
@@ -137,7 +153,6 @@ if ($MigrationType -eq "Import") {
137153
throw
138154
}
139155

140-
141156
$jsonFiles=Get-ChildItem*.json
142157
if ($jsonFiles) {
143158
$titles=$jsonFiles|ForEach-Object {"$($_.BaseName)" }

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp