SharePoint Online: Find Who Created a List or Library using PowerShell

Requirement: Find Who has created a list or library in SharePoint Online.

Find Who Created a List or Library in SharePoint Online using PowerShell

Get Who Created a Library in SharePoint Online:

If you want to find out who has created a SharePoint Online list or library: Sorry! There is no way from the SharePoint web user interface! You can’t get the “Created By” value anywhere. But PowerShell can help!

SharePoint Online: Find Who Created a List using PowerShell

We don’t have List.Author property exposed in CSOM. However, We can extract author information from SchemaXML of the list.

#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

#Function to call a non-generic method Load
Function Invoke-LoadMethod() 
   $ctx = $Object.Context
   $load = [Microsoft.SharePoint.Client.ClientContext].GetMethod("Load")
   $type = $Object.GetType()
   $clientLoad = $load.MakeGenericMethod($type)
   $Parameter = [System.Linq.Expressions.Expression]::Parameter(($type), $type.Name)
   $Expression = [System.Linq.Expressions.Expression]::Lambda([System.Linq.Expressions.Expression]::Convert([System.Linq.Expressions.Expression]::PropertyOrField($Parameter,$PropertyName),[System.Object] ), $($Parameter))
   $ExpressionArray = [System.Array]::CreateInstance($Expression.GetType(), 1)
   $ExpressionArray.SetValue($Expression, 0)

#Function to get user who created a SharePoint Online List or library
Function Get-SPOListAuthor($SiteURL,$ListName)
        #Get Credentials to connect
        $Cred= Get-Credential

        #Setup the context
        $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
        $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)

        #Get the List

        #Get List Schema XML
        Invoke-LoadMethod -Object $List -PropertyName "SchemaXML"

        #Extract Author from List Schema XML
        $ListSchema =  [xml] $List.SchemaXml
        $AuthorID = $ListSchema.List.Author
        $Author = $Ctx.web.GetUserById($AuthorID)
        Return $Author
    Catch {
        write-host -f Red "Error:" $_.Exception.Message

#Set Parameters

Get-SPOListAuthor -SiteURL $SiteURL -ListName $ListName

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply