导出用户列表到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

  

 

转载于:https://www.cnblogs.com/danielchen/p/3519233.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值