2

I would like to identify the creator of a list with PowerShell PnP. AFAIK, I need to read the Author property, but the best I've found is the GUID of the author.

> $l = Get-PnPList -Identity <the list> -Includes Fields
> $l.Fields | Where-Object InternalName -eq Author

Title    InternalName Id
-----    ------------ --
Créé par Author       1xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

I cannot get the user from these information. If there's a better way anyway, please, mention it!

12
  • Are you looking for the creator of the List, or of each item within the list? The Author field stores the creator of each item in the List, not of the list itself.
    – willman
    Commented Mar 2, 2020 at 12:32
  • I didn't know that Author field stores the creator of the items. I'm on the wrong track! I'm trying to get the creator of the list indeed (I'm the creator of the site collection).
    – tebans
    Commented Mar 2, 2020 at 13:03
  • I had found this link on MSDN for SP-2010 how-to-know-who-created-the-list-in-sharepoint-site. Author is mentioned as list creator: SPList.Author Property gives you an SPUser object that represents information about the user who created the list.. I'm looking for SP-2013+ preferably with PnP.
    – tebans
    Commented Mar 2, 2020 at 13:18
  • You cannot get that value through PnP, you'll have to run code on the server to use SPList.
    – willman
    Commented Mar 2, 2020 at 13:31
  • You can get the user who created the list using PowerShell. check this. I know this is not PnP-PowerShell but you can give it try. if it works for you. Commented Mar 2, 2020 at 13:40

1 Answer 1

2

Okay, so the List object exposed by CSOM and Pnp-PowerShell does not Directly contain the same Author property that the server-side object contains -- However, this value Is still in the underlying XML schema of the list. The schema is not returned by default when you call get-pnpList, but it can be included with the Includes, parameter, and then it is just a matter of parsing the Author attribute from the XML, which is very easy to do in PowerShell.

Give this a try:

$l = Get-PnPList -Identity <the list> -includes "SchemaXml"
$listSchema = [xml]$l.SchemaXml
$listCreatorUserId = $listschema.list.author
$listCreatorUser = get-pnpUser $listCreatorUserId
1
  • Bravo! it worked out perfectly. Thanks a lot.
    – jgran
    Commented Mar 2, 2020 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.