Hello SharePoint Pals,
Here is an Interesting piece of requirement that I would like to share with you all. Suddenly one of my customers had come up with a requirement , that he would like to know how frequent the SharePoint doucment library is modified and usage analytics of the documents in a document library. The simple and efficient method that I follow is to get Version History for all the documents in a SharePoint Library using PowerShell Commands.
Here is the piece of code provided below.
- $Site = Get-SPSite http:
-
- $Webs = $Site.AllWebs
-
- foreach ($Web in $Webs)
- {
- foreach ($List in $web.Lists)
- {
-
-
- if($List.EnableVersioning)
- {
- $Item=$List.Items[0]
- foreach($Version in $Item.Versions)
- {
- Write-Host "Documen Library Name:" $List.Title "-" "Document Name:" $Item.Title $Version.VersionLabel
- }
- }
- }
- }
- $Web.Dispose()
- $Site.Dispose()
Happy SharePointing :-)