I'm quite new with both SharePoint and PowerShell so please bear with me. I created a list on SharePoint and I'm trying to get the values of items in this list. For the most part this works ok except for the lookup fields. Whenever I tried to read the values of those fields I get the following value:
Microsoft.SharePoint.Client.FieldLookupValue
This is the code I use:
foreach ($item in $Items) {
$ListItem = [Microsoft.SharePoint.Client.ListItem]$listItem = $List.GetItemById($Item.FieldValues["ID"])
$SPListItemColumns = @{
Department = "Department"
}
$Department = $item.FieldValues[$SPListItemColumns.Department]
}
I tried the code found here, but this returns the following error: Unable to find type [Microsoft.SharePoint.SPFieldLookupValue].
Any help is appreciated, thanks.