Powershell: Empty FieldValue Array when reading a SharePoint Online List items that do exist

Copper Contributor

Here is my present Powershell Code. Though there are values in the FieldUserValue[] array, it reads as empty here, and that is the problem. A representation of the actual HTML list is below the code.

If (([Microsoft.SharePoint.Client.FieldUserValue[]]$ListItems["Visit_x0020_Attendees"]).Count -gt 0) { $FieldValues = [Microsoft.SharePoint.Client.FieldUserValue[]]$ListItems["Visit_x0020_Attendees"] Write-Host -f Red "FieldValues Count", $FieldValues.Count ForEach($FieldValue in $FieldValues) { Write-Host -f Yellow $FieldValue.LookupValue : $FieldValue.Email $ExportItem | Add-Member -MemberType NoteProperty -Name "Visit Attendees" -value $FieldValue.LookupValue } }

 

$ExportItem | Add-Member -MemberType NoteProperty -Name "Visit Attendees" -value $_["Visit_x0020_Attendees"].LookupValue - yields System.Object[] when there are multiple names.

 

$ExportItem | Add-Member -MemberType NoteProperty -Name "Visit Attendees" -value $_["Visit_x0020_Attendees"] - yields Microsoft.SharePoint.Client.FieldUserValue[] (no .LookupValue)

 

HTML of the SharePoint list item array. 

"Visit_x0020_Attendees": [{"id":"59","value":"Pam Tooler","title":"Pam Tooler","email":"PTooler@xyz.com","sip":"PTooler@xyz.com","picture":"","jobTitle":"Fiscal Manager","department":"Elections"},{"id":"153","value":"Loretta Lynn","title":"Loretta Lynn","email":"LLynn@xyz.com","sip":"LLynn@xyz.com","picture":"https:\u002f\u002fxyz.com-my.sharepoint.com:443\u002fUser%20Photos\u002fProfile%20Pictures\u002flg_MThumb.jpg","jobTitle":"Election Manager","department":"Elections"},{"id":"154","value":"Don Chapman","title":"Don Chapman","email":"DChapman@xyz.com","sip":"DChapman@xyz.com","picture":"","jobTitle":"Chief Deputy","department":"Clerk"}]

0 Replies