如何在视图中设置列位置
How to set column position in View
谁能指导我如何在使用 PnP Powershell 为 Sharepoint 在线列表创建的视图中设置列位置?
我在这里找不到位置选项:https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/set-pnpview?view=sharepoint-ps
谢谢,
您可以使用ViewFieldCollection.MoveFieldTo 方法来设置视图中的列位置。这是我给你的演示:
#Config Variables
$SiteURL = "https://tenant.sharepoint.com/sites/michael"
$ListName= "list"
$ViewName= "Test"
#Connect to PNP Online
Connect-PnPOnline -Url $SiteURL
#Get the Context
$Context = Get-PnPContext
#Get the List View from the list
$ListView = Get-PnPView -List $ListName -Identity $ViewName
#Set Created field to first position. STARTS WITH 0.
$ListView.ViewFields.MoveFieldTo("Created",0)
$ListView.Update()
$Context.ExecuteQuery()
谁能指导我如何在使用 PnP Powershell 为 Sharepoint 在线列表创建的视图中设置列位置?
我在这里找不到位置选项:https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/set-pnpview?view=sharepoint-ps
谢谢,
您可以使用ViewFieldCollection.MoveFieldTo 方法来设置视图中的列位置。这是我给你的演示:
#Config Variables
$SiteURL = "https://tenant.sharepoint.com/sites/michael"
$ListName= "list"
$ViewName= "Test"
#Connect to PNP Online
Connect-PnPOnline -Url $SiteURL
#Get the Context
$Context = Get-PnPContext
#Get the List View from the list
$ListView = Get-PnPView -List $ListName -Identity $ViewName
#Set Created field to first position. STARTS WITH 0.
$ListView.ViewFields.MoveFieldTo("Created",0)
$ListView.Update()
$Context.ExecuteQuery()