I have an issue updating multi-values in a lookup field via powershell
I can update a single value lookup field as below but can't get to update if its multi- value.
As stated below when I hardcode it. It works.
No idea what 'm missing. Any help will be appreciated.
$array = @($realval.Split(';'))
for ($i = 0; $i -lt $array.Count - 1; $i += 2)
{
$word = $array[$i].Trim('#')
$number = $array[$i+1].Trim('#')
#$number
"$number $word"
#send param to GetLoolValues func to return records as SPFieldLookupValue
$lookupvalue1 = GetLookUpValues -val $number
#I can view the lookupvalue returned successfully
#Write-Host $lookupvalue1
[Microsoft.SharePoint.SPFieldLookupValueCollection] $itemValues = New-Object Microsoft.SharePoint.SPFieldLookupValueCollection
#This LookupId returns 3 values like so :1,2,6
$lookupvalue.LookupId = $number
$itemValues.Add($lookupvalue)
$CMRSItems["Event Type"] = $itemValues;
#I can view the items returned successfully
Write-Host "items:" $itemValues
$CMRSItems.Update()
}
** GetLookUpValues this is how it works I pass an ID to list items and return data of type SPFieldLookupValue