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


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

步骤

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

  • 在PlaceHolderMain里面插入代码,黄色部分需要替换


7D911007-C00D-4597-B026-FF510897E8A9" RootWebId="060302af-ed9d-4c36-b56b-d46a1c0eb4f4" ShowFolderChildren="true" EnableViewState="false"> 15" SelectedNodeStyle-CssClass="ms-tvselected">
//Here is the content of webpart zone
//Library Content
  • 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的内容