SharePoint Online:PowerShell 禁用现代体验
要求:禁用 SharePoint Online 中的新式体验。
如何在列表中禁用新用户体验并切换回经典视图?
当然,SharePoint Online 列表和库中的现代体验更快、适合移动设备且更易于使用。它带来了新的功能和组件,例如:使用信息面板快速编辑元数据、Pin-Filter、复制移动、自定义视图、列格式、文件夹上传等。但是,某些功能只能在经典体验中使用。因此,您有时可能需要禁用 SharePoint Online 中的新式体验。如何将 SharePoint Online 更改为经典视图?
要禁用 SharePoint Online 中的现代体验,请导航到列表或库并使用左下角的“返回经典 SharePoint”链接。
这将所有列表和库设置为使用经典体验。
在列表级别禁用现代体验:
只需更改以下列表设置,即可在 SharePoint Online 中的经典体验和新体验之间切换。
PowerShell 禁用列表中的现代体验
让我向您展示如何使用 PowerShell 禁用 SharePoint Online 中的现代体验:
#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
#Variables for Processing
$SiteUrl = "https://crescent.sharepoint.com/sites/marketing/2018"
$ListName= "Documents"
#Get Credentials to connect
$Cred = Get-Credential
Try {
#Set up the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
$Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)
#PowerShell to disable modern experience in SharePoint Online
$List = $Ctx.web.Lists.GetByTitle($ListName)
$List.ListExperienceOptions = "ClassicExperience"
$List.Update()
$Ctx.ExecuteQuery()
Write-host "Modern Experience has been Disabled for the list!" -ForegroundColor Green
}
catch {
write-host "Error: $($_.Exception.Message)" -Foregroundcolor Red
}
如何在网站集级别禁用新体验?
如何在 SharePoint Online 中将现代网站更改为经典网站?要关闭网站集的现代体验,请按照下列步骤操作:
如果列表体验设置为“网站的默认体验”,这将关闭网站集级别的所有列表和库的现代体验。
使用 PnP PowerShell 禁用网站集中的现代体验
如何恢复到经典 SharePoint?使用此 PowerShell 脚本激活经典视图:
#Config Variables
$SiteURL = "https://crescent.sharepoint.com/sites/marketing"
#Connect PnP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)
#Disable Modern Experience at Site Collection level by activating Classic Exp Feature
Enable-PnPFeature -Identity "E3540C7D-6BEA-403C-A224-1A12EAFEE4C4" -Scope Site
同样,如果您需要在 Web 级别禁用新体验,请使用:
Enable-PnPFeature -Identity "52E14B6F-B1BB-4969-B89B-C4FAA56745EF" -Scope Web
如果需要使用 PowerShell CSOM 脚本启用或禁用网站或网站集的新式体验,请使用:SharePoint Online:使用 PowerShell 将列表 UI 设置为新式体验或经典体验
结论
SharePoint Online 现代体验提供了更直观、用户友好的界面。但是,在某些情况下,由于兼容性问题或为了保持与 SharePoint 早期版本的一致性,组织可能需要禁用 SharePoint Online 中的新式体验。可以通过使用 PowerShell 来禁用 SharePoint Online 中的现代体验。通过执行本文中概述的步骤,您可以成功禁用特定网站集或整个 SharePoint Online 环境的新式体验。



