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

[玩转系统] 将“用户信息列表”导出到 SharePoint 中的 Excel

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

将“用户信息列表”导出到 SharePoint 中的 Excel


有一次,我需要将一个网站集的所有用户导出到Excel,我的将用户信息列表导出到Excel的技巧如下:

如何将用户信息列表导出到SharePoint中的Excel?

按照以下步骤导出用户信息列表。

  • 导航至站点设置 >> 人员和组。现在您的浏览器 URL 应类似于“https://SHAREPOINT-SITE.com/_layouts/15/start.aspx#/_layouts/15/people.aspx?MembershipGroupId=22”。只需将“MembershipGroupId”的值替换为“0”即可获得“所有人”视图,其中列出了该网站的所有用户(只不过是“用户信息列表”)。
  • 从这里获取用户信息列表和视图的 GUID。这是如何获取SharePoint列表或视图的GUID?
  • 在此 URL 中替换您的“列出 GUID”和“查看 GUID”,然后将其复制粘贴到浏览器中:
    https://SHAREPOINT-SITE-URL.com/_vti_bin/owssvr.dll?CS=109&Using=_layouts /query.iqy&List={LIST-GUID}&View={VIEW-GUID}&CacheControl=1
  • 导航到上面的 URL,它应该打开查询,启动 Microsoft Excel,并将所有用户从用户信息列表导入到 Excel!

    [玩转系统] 将“用户信息列表”导出到 SharePoint 中的 Excel

使用 PowerShell 将用户信息列表导出到 CSV:

以下是将 SharePoint 用户信息列表导出到 CSV 的 PowerShell 脚本:


Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Variables
$SiteUrl="https://intranet.crescent.com"
$OutPutFile = "C:\UserInfoList.csv" 

#Get Web and User Information List
$web = Get-SPWeb $siteUrl
$UserInfoList = $Web.Site.RootWeb.Lists["User Information List"]

#Array to Hold Result - PSObjects
$ListItemCollection = @()
 
 #Get All List items where Status is "In Progress"
 $UserInfoList.Items | foreach {
 $ExportItem = New-Object PSObject 
 $ExportItem | Add-Member -MemberType NoteProperty -name "User Name" -value $_["Name"]
 $ExportItem | Add-Member -MemberType NoteProperty -Name "Department" -value $_["Department"]
 $ExportItem | Add-Member -MemberType NoteProperty -name "Job Title" -value $_["Job Title"]
 $ExportItem | Add-Member -MemberType NoteProperty -name "About Me" -value $_["About Me"]
 
 #Add the object with property to an Array
 $ListItemCollection += $ExportItem
 }
 #Export the result Array to CSV file
$ListItemCollection | Export-CSV $OutPutFile -NoTypeInformation  
Write-host "User Information List Exported to $($OutputFile) for site $($SiteURL)"

$web.Dispose()

这会将网站集的所有用户和组导出到 CSV 文件。

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

取消回复欢迎 发表评论:

关灯