Tuesday 23 July 2019

How to check who created view in SharePoint online


How to check who created list view in SharePoint online document library/ list

You cannot get the information who a view created because it's not cover by the object model. The  object doesn't store a property for modified or created. To get the information all you can do is to get the information from the file. So for the view url you need to request the file url****.aspx.
The file object stores the "Author", "TimeCreated", "Modified" and "Modified by" values.
The PowerShell Script looks like this:

# Load required dlls
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.DocumentManagement")


$SiteUrl = "https://Yourtenent.sharepoint.com/sites/sitename"
$viewurl = "https://Yourtenent.sharepoint.com/sites/sitename/Shared%20Documents/Forms/Custom.aspx"

$sUserName="admin@Yourtenent.onmicrosoft.com" 
$securePassword= ConvertTo-SecureString "your password" -asplaintext -force
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($sUserName, $securePassword)

$spoCtx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
$spoCtx.Credentials = $Credentials      
$spoCtx.RequestTimeOut = 5000 * 60 * 10;
$web = $spoCtx.Web
$site = $spoCtx.Site
$spoCtx.Load($web.Webs)
$spoCtx.Load($site)
$spoCtx.ExecuteQuery()
Write-Host "connected successfully"
$targetUrl =$web.GetFileByUrl("https://Yourtenent.sharepoint.com/sites/learninghub/Shared%20Documents/Forms/Custom.aspx")

$spoCtx.Load($targetUrl)
$spoCtx.Load($targetUrl.Author)
$spoCtx.ExecuteQuery()
Write-Host "View: $($targetUrl.Name)"
Write-Host "Author $($targetUrl.Author.UserPrincipalName)"
Write-Host "Created On: $($targetUrl.TimeCreated)"

4 comments:

  1. Sophisticated describe the information. The information is real true. I am happy to go through your page. Keep Writing…
    Germany VPS Hosting

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Good! article, You describe very well on "How to check who created list view in SharePoint Online document library/ list?" this is really true. I was searching for this kind of information. Our Onlive Server offers a wide range of operating systems of USA VPS Hosting plans that have better performance and reliability.
    thanks

    ReplyDelete



  4. Impressive, this is very important to know for all of us about this knowledge. It is very pleasure to get it as I got huge helps right here. If you want to know about server hosting or interested in best USA VPS hosting Join and grow your business I really love your blog and surely recommend to my friends. keep it u....!!! Thank you so much for sharing this and I wish you all the best for the upcoming article.

    ReplyDelete