0 comment

Get creation and modification Information from Views in Lists and Libraries using PowerShell

The “Modified”, “Modified By”, “Created by”, “Created” cannot be accessed directly via the SPView object because this simply doesn’t store that kind of information. To request this information the SPFile object needs to be used instead.

To get this information the following power shell script can be used:
# define variables for script
$SiteUrl = "http://yourserver/sites/yoursite"
$viewurl = "http://yourserver/sites/yoursite/Lists/customlist/AllItems.aspx"

$targetUrl = Get-SPWeb -Identity $SiteUrl
if ($targetUrl -ne $null)
    $targetFile = $targetUrl.GetFile($viewurl)

        Write-Host "Created By: " $targetFile.Author
        Write-Host "Modified: " $targetFile.TimeLastModified
        Write-Host "Modified By: " $targetFile.ModifiedBy
        Write-Host "Created: " $targetFile.TimeCreated
        Write-Host "File doesn't exist"

Leave a Reply

Required fields are marked *.

This site uses Akismet to reduce spam. Learn how your comment data is processed.