Find Who has Created / Modified a SharePoint View
Have you ever wondered how to find the user who has created or modified a particular SharePoint view? And when was it created/modified? Well, there is no SharePoint UI to get this information! But using the SharePoint object model, we can retrieve these data programmatically from SPFile object’s properties.
Here is how I retrieved “Created By”, “Created On”, “Modified By”, and “Modified On” values using PowerShell:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Set these two variables accordingly
$WebURL = "https://sharepoint.crescent.com/"
$ViewURL = "https://sharepoint.crescent.com/LegalDoc/AuthorView.aspx"
#Get the Web
$web = Get-SPWeb $WebURL
#Get the View File
$ViewFile = $web.GetFile($viewURL)
Write-Host "Created By: " $ViewFile.Author
Write-Host "Created on: " $ViewFile.TimeCreated
Write-Host "Modified By: " $ViewFile.ModifiedBy
Write-Host "Modified On: " $ViewFile.TimeLastModified
PnP PowerShell to Get List View Created By/ Modified By Details
#Config Variables
$SiteURL = "https://crescent.sharepoint.com/sites/retail"
$ListName= "Projects"
$ViewName = "All Projects"
Try {
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive
#Get the Web
$Web = Get-PnPWeb
#Get the List Views from the list
$ListView = Get-PnPView -List $ListName -Identity $ViewName
#Get the View File
$ViewFile = $Web.GetFileByServerRelativeUrl($ListView.ServerRelativeUrl)
$Properties = Get-PnPProperty -ClientObject $ViewFile -Property Author, ModifiedBy, TimeCreated, TimeLastModified
Write-Host "Created By: " $ViewFile.Author.Email
Write-Host "Created on: " $ViewFile.TimeCreated
Write-Host "Modified By: " $ViewFile.ModifiedBy.Email
Write-Host "Modified On: " $ViewFile.TimeLastModified
}
catch {
write-host "Error: $($_.Exception.Message)" -foregroundcolor Red
}
does not work for SP online
Use the PnP PowerShell script for SharePoint Online!