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

[玩转系统] 使用 PnP PowerShell 获取 SharePoint Online 中的所有文档库

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

使用 PnP PowerShell 获取 SharePoint Online 中的所有文档库


要求:使用 PowerShell PnP 获取 SharePoint Online 中的所有文档库。

PnP PowerShell 获取 SharePoint Online 中的所有文档库

您想要获取 SharePoint Online 网站上所有文档库的列表吗? PowerShell 让一切变得简单!在这篇文章中,我将向您展示如何使用 PowerShell 获取您网站上所有文档库的列表。

要获取库列表,您首先需要使用 PowerShell 连接到 SharePoint Online。连接后,您可以运行 Get-PnPList cmdlet 来获取站点中所有列表和库的列表,并从中筛选文档库。可以通过基本模板或基本类型属性从列表集合中过滤文档库。具体方法如下:


#Set Variables
$SiteURL = "https://crescent.sharepoint.com/sites/marketing"
 
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive

#Get all document libraries - Exclude Hidden Libraries
$DocumentLibraries = Get-PnPList | Where-Object {$_.BaseTemplate -eq 101 -and $_.Hidden -eq $false} #Or $_.BaseType -eq "DocumentLibrary"

#Get Document Libraries Name, Default URL and Number of Items
$DocumentLibraries | Select Title, DefaultViewURL, ItemCount

此 PowerShell 脚本从给定站点 URL 获取所有文档库,以及库 URL 和每个库中的许多项目。如果您需要生成报告或对库执行某些其他分析,甚至迭代站点中的所有文档库,这会很有用。

[玩转系统] 使用 PnP PowerShell 获取 SharePoint Online 中的所有文档库

以下是使用 CSOM PowerShell 获取 SharePoint Online 网站上所有文档库的另一个脚本:SharePoint Online:列出所有文档库的 PowerShell

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

取消回复欢迎 发表评论:

关灯