当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] 使用 PowerShell 重置 SharePoint 列表视图筛选器

作者:精品下载站 日期:2024-12-14 14:01:12 浏览:13 分类:玩电脑

使用 PowerShell 重置 SharePoint 列表视图筛选器


要求:重置 SharePoint 视图过滤器。

解决方案:要批量重置 SharePoint 视图,我们可以使用此 PowerShell 脚本。

用于重置 SharePoint 视图的 PowerShell 脚本:


Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$WebURL = "https://sales.crescent.com"
$ListName = "Proposal Documents"
$ViewName = "All Proposals"  
 
#Get the Site, List and View objects
$web = Get-SPWeb $WebURL
$List = $Web.Lists[$ListName]
$View = $List.Views | ? {$_.title -eq $ViewName}

#Reset SharePoint View - By default sort by Name
$View.Query = "<OrderBy><FieldRef Name='FileLeafRef' /></OrderBy>" 
$View.Update()
$List.Update()

此脚本删除应用于给定 SharePoint 列表视图的排序和筛选器。

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯