如何查询SharePoint Library中空文件夹?
【如何查询SharePoint Library中空文件夹?】分享给互联网技能从业者学习和参考。

企业在使用SharePoint过程中,都会因为各种需求考虑对SharePoint做升级。而在升级之前我们都知道要对源端数据作分析,此时经常会被问到“在我的Library中有多少文件夹下面没有文件?”,对此进行了script查询整理和验证,具体请参考下面。
Scriptif($TestSPSnapin-eq $null){add-pssnapin -NameMicrosoft.SharePoint.Powershell #-ErrorAction SilentlyContinue# SilentlyContinue is only good forinteractive console where you're sure of each command you're running.Otherwise, the script should block execution on snapin load failure.}functionCheckFolderContents ($folder){$folderContent = "Folder at URL " $folder.Url " has " $folder.Files.Count " files and" $folder.SubFolders.Count " subfolders.`n"Add-Content C:FolderContents.txt $folderContentforeach($subfolder in $folder.SubFolders){if ($subfolder.item -ne $null) # thedefault "Forms" folder has a null Item, and we don't need to includethe default "Forms" folder as part of this{CheckFolderContents $subfolder}}}## MAIN$web =Get-SPWeb http://SharePointSiteCollectionURL$list =$web.Lists["LibraryName"]CheckFolderContents$list.RootFolder$web.Dispose()
在执行完成后会在具体路径下生成report。
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。