导出用户列表到Excel的几种方法

最近客户在咨询着怎么把SharePoint上面的用户列表给到出Excel,查看了一下,SharePoint并没有提供直接可用的导出功能(虽然都是List,但就是不让你导出。。。)

网上搜索了一下,方法多种多样,按需而用吧。

方法一:

1. 打开你要导出的SharePoint Group页面。 
2. 复制该页面URL。 
3. 打开Excel > Data > From Web,然后将上一步复制的URL粘贴过去,然后点击GO。

你会看到页面上有很多黄色箭头,选择User Group的表格,然后点击import。

方法二:

1. 打开People and Groups页面。
2. 选择Settings > List Settings。
3. 选择ViewList View。 
4. 选择想要导出的field。
5. 从该页面的URL复制List和View的ID。 
6. 用复制的ID替换下面URL的[LISTID]和[VIEWID],然后浏览器打开它。 
URL Format: {Site URL}/_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List={List GUID}&View={View GUID}&CacheControl=1

方法三:

编写VBA调用SharePoint的Web Service导出用户列表到XML

Function GetUserGroups(userName As String,webUrl As String)
Dim soapClient As MSXML2.XMLHTTP Set soapClient = New MSXML2.XMLHTTP Dim xmlDoc As MSXML2.DOMDocument
Set xmlDoc = New MSXML2.DOMDocument 'Creating SOAP Envelope
Dim body As String body = "<?xml version=""1.0"" encoding=""utf-8""?>" & _
"<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">" & _
"<soap:Body>" & _
"<GetGroupCollectionFromUser xmlns=""http://schemas.microsoft.com/sharepoint/soap/directory/"">" & _
"<userLoginName>" & userName & "</userLoginName>" & _
"</GetGroupCollectionFromUser >" & _
"</soap:Body>" & _
"</soap:Envelope>" 'Load it in an xml document
xmlDoc.LoadXML body 'Open HTTP port
soapClient.Open "POST", webUrl & "_vti_bin//usergroup.asmx", False
'Send soap envelope via HTTP
soapClient.send xmlDoc 'Parse result to retreive groups
Dim strGroups As String
strGroups = ""
If soapClient.readyState = 4 Then
If soapClient.Status = 200 Then
Dim grp As IXMLDOMNode
For Each grp In soapClient.responseXML.getElementsByTagName("Group")
Debug.Print (grp.XML)
Dim attr As IXMLDOMAttribute For Each attr In grp.Attributes
If attr.Name = "Name" Then
If strGroups <> "" Then
strGroups = strGroups & ";"
End If
strGroups = strGroups & attr.Value
End If Next Next
Else
Debug.Print XMLHttpReq.Status & ", " & XMLHttpReq.responseText
End If
End If
GetUserGroups = strGroups
End Function

  

上一篇:EAV/ESS 8.x 自定义服务器正确方法+更新服务器列表


下一篇:如何调试 Java 开源项目源码,记一种源码导入开发工具并调试的通用方法