SharePoint Online:如何将列表更改为现代体验?
要求:更改 SharePoint Online 中的列表体验。
如何将 SharePoint Online 列表设置为新体验?
SharePoint Online 的新列表体验为列表和库提供了更快、更简单的用户界面。现代体验不仅流畅且响应灵敏,而且还为列表和库的用户界面添加了新的增强功能,例如列格式、条件格式、快速编辑等。您可以通过简单地更改 SharePoint Online 中的经典体验和新体验之间进行切换列表设置。
要将列表或库更改为新的现代用户界面,请执行以下操作:
这会将列表 UI 更改为 SharePoint Online 中的新体验,从:
收件人:SharePoint Online 中的新列表体验
为所有新列表设置默认选项怎么样?
若要设置新列表的列表体验,您可以使用 SharePoint 管理中心全局指定此选项。具体方法如下:
- 导航到您的 SharePoint 管理中心(通常:https://YOURCOMPANY-admin.sharepoint.com/)。
- 单击左侧导航中的“设置”>> 单击底部的“经典设置页面”链接。
- 在设置页面的“SharePoint 列表和库体验”部分下,选择适当的选项,例如经典体验或新体验(自动检测)。
PowerShell 在 SharePoint Online 中切换列表或库的 UI 体验:
在任何现有的 SharePoint Online 列表和库上,您可以使用上面说明的 SharePoint Web UI 方法或使用下面的 PowerShell 脚本来切换 UI 体验。
#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/sales"
$ListName= "Project Documents"
$UserName="salaudeen@crescent.com"
$Password ="Password goes here"
#Setup Credentials to connect
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName,(ConvertTo-SecureString $Password -AsPlainText -Force))
Try {
#Set up the context
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
$Context.Credentials = $credentials
#Get the document library
$List = $Context.web.Lists.GetByTitle($ListName)
#Set list properties
$List.ListExperienceOptions = "NewExperience" #ClassicExperience or Auto
$List.Update()
$context.ExecuteQuery()
Write-host "UI experience updated for the list!" -ForegroundColor Green
}
catch {
write-host "Error: $($_.Exception.Message)" -foregroundcolor Red
}
SharePoint Online 新体验不起作用?
在某些情况下,即使从列表设置更改列表体验设置后,您仍会获得相同的 UI。这是因为浏览器cookie!只需清除您的浏览 cookie 并重新加载页面即可解决问题。 (具体来说,该cookie名为“spInu”,值为0!)
在 SharePoint Online 中使用 PnP PowerShell 更改列表体验
让我们将 SharePoint Online 列表的默认列表体验更改为“新体验”或“现代体验”。
#Config Variables
$SiteURL = "https://Crescent.sharepoint.com"
$ListName = "Team Documents"
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive
#Set List Experience
Set-PnPList -Identity $ListName -ListExperience NewExperience
要获取列表体验设置,请使用:
Get-PnPList -Identity "List Name" -Includes ListExperienceOptions其中:0=自动、1=现代、2=经典
PnP PowerShell 将网站集中所有列表的列表体验设置为现代
让我们将网站集中的所有列表设置为“现代”!
#Variable
$SiteURL ="https://Crescent.sharepoint.com/sites/marketing"
#Connect to PnP Online
Connect-PnPOnline -URL $SiteURL -Interactive
#Get all the Webs
$Webs = Get-PnPSubWeb -Recurse -IncludeRootWeb
ForEach($Web in $Webs)
{
Write-host "Processing Web:"$Web.URL -f Yellow
#Get All Lists from web and Iterate through
$Lists = Get-PnPProperty -ClientObject $Web -Property Lists
ForEach($List in $Lists)
{
If($List.ListExperienceOptions -ne "NewExperience" -and ($List.Hidden -eq $false))
{
#Set List Experience to Modern
Write-host "`tSetting List Experience to Modern:"$List.Title
Set-PnPList -Identity $List -ListExperience NewExperience
}
}
}



