Issue retrieving value of People Picker using PnP PowerShell for SP 2013
-
08-02-2021 - |
Question
I'm retrieving all of the values from a list and it's working fine on all of the fields except the People and Group Picker column.
It returns:
Microsoft.SharePoint.Client.FieldUserValue
I'm trying to retrieve it using the following syntax (although I've tried everything):
"Content Author" = $libitem["KBContentAuthor"].LookupValue
Thanks!
Solution
You need to also additional fetch details as below via Get-PnPUser
command:
$value = $libitem["KBContentAuthor"]
$user = Get-PnPUser -Identity $value.LookupId
# added this just for explanation, you can remove it from the code
$email = $user.Email
$username = $user.LoginName
$fullname = $user.Title
"Content Author" = $user.Title
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange