使用文档列表中的子文件夹维护 Sharepoint Server Url
Maintain Sharepoint Server Url with subfolders in document list
我想遍历 Sharepoint 文档库项目(文件、文件夹和子文件夹),然后打印 Excel sheet
中的每个文件夹内容
我的宏中有以下代码
Sub WriteFileProp(mySourcePath As String)
Dim objMyList As ListObject
Dim objWksheet As Worksheet
Dim strSPServer As String
Dim SERVER As String
Const LISTNAME As String = "Documents"
Const VIEWNAME As String = ""
SERVER = mySourcePath
' The SharePoint server URL pointing to
' the SharePoint list to import into Excel.
strSPServer = "http:" & SERVER & "/_vti_bin"
' Add a new worksheet to the active workbook.
Set objWksheet = Worksheets.Add
' Add a list range to the newly created worksheet
' and populated it with the data from the SharePoint list.
Set objMyList = objWksheet.ListObjects.Add(xlSrcExternal, _
Array(strSPServer, LISTNAME, VIEWNAME), False, , Range("A1"))
End Sub
那个函数
Dim objFSO As Object
Dim objFolder As Object
Dim ObjFile As Object
Dim SubFolder As Object
Dim pth As String
Dim WBn As Workbook
Dim ObCount As Long
Dim FileNme As String
Application.ScreenUpdating = False
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Get the folder object associated with the directory
Set objFolder = objFSO.GetFolder("//S1.S2.S3Portal/Shared%20Documents/")
Call WriteFileProp("S1.S2.S3Portal.com/")
'Print main view
For Each SubFolder In objFolder.SubFolders
Call WriteFileProp(SubFolder.Path)
Next
在 Call WriteFileProp("S1.S2.S3Portal.com/")
之前一切正常
之后我循环查找子文件夹并且路径不兼容
中提供的 ServerUrl
objWksheet.ListObjects.Add(xlSrcExternal, _
Array(strSPServer, LISTNAME, VIEWNAME), False, , Range("A1"))
即假设第一个子文件夹名称是 Software,其路径格式如下
//S1.S2.S3Portal/Shared%20Documents/Software
但是 ListObjects.Add 只接受根据 msdn
的格式
strSPServer = http://S1.S2.S3Portal
列表名称= "Documents"
视图=""
无论如何都可以维护该文档的子文件夹 Urls。库并使用 ListObjects.Add 或类似函数
将它们添加到 excel 工作簿
我使用 GetListItems 与 Soap 查询和网络服务来获取列表项而不是发布的方法
我想遍历 Sharepoint 文档库项目(文件、文件夹和子文件夹),然后打印 Excel sheet
中的每个文件夹内容我的宏中有以下代码
Sub WriteFileProp(mySourcePath As String)
Dim objMyList As ListObject
Dim objWksheet As Worksheet
Dim strSPServer As String
Dim SERVER As String
Const LISTNAME As String = "Documents"
Const VIEWNAME As String = ""
SERVER = mySourcePath
' The SharePoint server URL pointing to
' the SharePoint list to import into Excel.
strSPServer = "http:" & SERVER & "/_vti_bin"
' Add a new worksheet to the active workbook.
Set objWksheet = Worksheets.Add
' Add a list range to the newly created worksheet
' and populated it with the data from the SharePoint list.
Set objMyList = objWksheet.ListObjects.Add(xlSrcExternal, _
Array(strSPServer, LISTNAME, VIEWNAME), False, , Range("A1"))
End Sub
那个函数
Dim objFSO As Object
Dim objFolder As Object
Dim ObjFile As Object
Dim SubFolder As Object
Dim pth As String
Dim WBn As Workbook
Dim ObCount As Long
Dim FileNme As String
Application.ScreenUpdating = False
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Get the folder object associated with the directory
Set objFolder = objFSO.GetFolder("//S1.S2.S3Portal/Shared%20Documents/")
Call WriteFileProp("S1.S2.S3Portal.com/")
'Print main view
For Each SubFolder In objFolder.SubFolders
Call WriteFileProp(SubFolder.Path)
Next
在 Call WriteFileProp("S1.S2.S3Portal.com/")
之前一切正常
之后我循环查找子文件夹并且路径不兼容
objWksheet.ListObjects.Add(xlSrcExternal, _
Array(strSPServer, LISTNAME, VIEWNAME), False, , Range("A1"))
即假设第一个子文件夹名称是 Software,其路径格式如下 //S1.S2.S3Portal/Shared%20Documents/Software
但是 ListObjects.Add 只接受根据 msdn
的格式strSPServer = http://S1.S2.S3Portal
列表名称= "Documents"
视图=""
无论如何都可以维护该文档的子文件夹 Urls。库并使用 ListObjects.Add 或类似函数
将它们添加到 excel 工作簿我使用 GetListItems 与 Soap 查询和网络服务来获取列表项而不是发布的方法