SharePoint 2010: Get the Created and Modified date of an SPView using PowerShell

Introduction

The following file information, Created, Created By, Modified,  Modify By, cannot be accessed directly via the SPView object. The SPView object doesn't provide these properties. Use the SPFile object to access these properties.

Getting the Information using PowerShell

The following PowerShell script can be used to retrieve these properties:

# 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)
    if($targetFile.Exists)            
    {            
        Write-Host "Created By: " $targetFile.Author            
        Write-Host "Modified: " $targetFile.TimeLastModified            
        Write-Host "Modified By: " $targetFile.ModifiedBy            
        Write-Host "Created: " $targetFile.TimeCreated            
    }            
    else            
    {            
        Write-Host "File doesn't exist"            
    }            
}

See Also

An important place to find a huge amount of SharePoint related articles is the TechNet Wiki itself. The best entry point is SharePoint Resources on the TechNet Wiki

References

Other languages

This article is also available in the following languages :