如何使用 PowerShell 删除已应用的 PnPProvisioningTemplate?
How to remove a applied PnPProvisioningTemplate with PowerShell?
如标题所说,如何使用 PowerShell 删除已应用的 PnPProvisioningTemplate?
我已经在所有 "Custom Action's Name attribute" 上尝试了 Remove-PnPCustomAction,但是在 运行 这个脚本之后它不起作用。
我用了这个例子:
https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/modern-experience-customizations-customize-lists-and-libraries 和 "Custom Tab" 功能区示例。
此模块:SharePointPnPPowerShellOnline
# Connect to a previously created Modern Site
$cred = Get-Credential;
Connect-PnPOnline -Url https://[tenant].sharepoint.com/sites/dev/ -Credentials $cred;
Write-Host "Connected to SharePoint!";
$scriptPath = "$($PSScriptRoot)\custom_action.xml";
Write-host "Running script: $($scriptPath)";
# Apply the PnP provisioning template
#Apply-PnPProvisioningTemplate -Path $scriptPath -Handlers CustomActions;
#Write-host "Applied custom action!";
$test = Get-PnPCustomAction;
Write-Host $test;
#Remove-PnPCustomAction -Identity CA_4 -Force
#Write-Host "Removed custom Action"
谢谢。
PnP 配置引擎仅在站点上设置 API 配置并上传可能的资产。没有实际的 "template" 可以从站点中删除,但您绝对可以删除应用于模板的配置。
例如,删除 UserCustomAction 配置取决于您在实际模板中所做的配置。在示例案例中,CustomActions 应用于 SiteCollection 级别,因此您需要记住正确使用 Scope 参数。请参阅 https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/Remove-PnPCustomAction?view=sharepoint-ps
中的文档
我也遇到过类似的情况,我可以通过以下步骤删除自定义操作
首先:-
Get-PnPCustomAction -Scope All
这将为您提供站点中的所有自定义操作,每个自定义操作都有一个标识
然后 :-
Remove-PnPCustomAction -Identity "identity"
希望对您有所帮助。
如标题所说,如何使用 PowerShell 删除已应用的 PnPProvisioningTemplate?
我已经在所有 "Custom Action's Name attribute" 上尝试了 Remove-PnPCustomAction,但是在 运行 这个脚本之后它不起作用。
我用了这个例子: https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/modern-experience-customizations-customize-lists-and-libraries 和 "Custom Tab" 功能区示例。
此模块:SharePointPnPPowerShellOnline
# Connect to a previously created Modern Site
$cred = Get-Credential;
Connect-PnPOnline -Url https://[tenant].sharepoint.com/sites/dev/ -Credentials $cred;
Write-Host "Connected to SharePoint!";
$scriptPath = "$($PSScriptRoot)\custom_action.xml";
Write-host "Running script: $($scriptPath)";
# Apply the PnP provisioning template
#Apply-PnPProvisioningTemplate -Path $scriptPath -Handlers CustomActions;
#Write-host "Applied custom action!";
$test = Get-PnPCustomAction;
Write-Host $test;
#Remove-PnPCustomAction -Identity CA_4 -Force
#Write-Host "Removed custom Action"
谢谢。
PnP 配置引擎仅在站点上设置 API 配置并上传可能的资产。没有实际的 "template" 可以从站点中删除,但您绝对可以删除应用于模板的配置。
例如,删除 UserCustomAction 配置取决于您在实际模板中所做的配置。在示例案例中,CustomActions 应用于 SiteCollection 级别,因此您需要记住正确使用 Scope 参数。请参阅 https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/Remove-PnPCustomAction?view=sharepoint-ps
中的文档我也遇到过类似的情况,我可以通过以下步骤删除自定义操作
首先:-
Get-PnPCustomAction -Scope All
这将为您提供站点中的所有自定义操作,每个自定义操作都有一个标识
然后 :-
Remove-PnPCustomAction -Identity "identity"
希望对您有所帮助。