Sharepoint 文档库根据文件夹层级展示

类似于资源管理器,效果如下

Sharepoint 文档库根据文件夹层级展示

步骤

  • 打开Sharepoint Desinger,编辑Allitems.aspx页面

Sharepoint 文档库根据文件夹层级展示

  • 在PlaceHolderMain里面插入代码,黄色部分需要替换
<table style="width:100%">
<tr style="vertical-align:top">
<td style="width:300px">
<SharePoint:SPHierarchyDataSourceControl id="doclibDataSource" runat="server" RootListId="7D911007-C00D-4597-B026-FF510897E8A9"
RootWebId="060302af-ed9d-4c36-b56b-d46a1c0eb4f4" ShowFolderChildren="true" EnableViewState="false">
</SharePoint:SPHierarchyDataSourceControl>
<SharePoint:SPTreeView ID="doclibtreeview" runat="server" DataSourceID="doclibDataSource" EnableViewState="false" ExpandDepth="15"
SelectedNodeStyle-CssClass="ms-tvselected">
</SharePoint:SPTreeView></td>
<td>
//Here is the content of webpart zone
//Library Content
</td>
</tr>
</table>
  • RootListId为Document Library的GUID

Edit List Library就可以在URL中得到,但是需要转义,地址:

http://www.convertstring.com/zh_CN/EncodeDecode/UrlDecode

  • RootWebId可以通过Powershell得到
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null)
{
Write-Host "Loading SharePoint Powershell Snapin..."
Add-PSSnapin "Microsoft.SharePoint.Powershell"
Write-Host "SharePoint Powershell Snapin Loaded"
} $webURL = "http://xxxxx/site/"
$web = Get-SPWeb -Identity $webURL
$web.ID
  • ExpandDepth是默认展开层数
  • Content就是Webpartzone中的list library的内容

  

上一篇:总结Vue 第四天:vue-cli(Vue2.0 新手入门 — 从环境搭建到发布)


下一篇:MySQL 查询最大最小值优化