I'm trying to set multiple values to lookup column. I can get it to set one value but multiple values don't work
see below
[Microsoft.SharePoint.SPFieldLookupValueCollection] $itemValues = New-Object Microsoft.SharePoint.SPFieldLookupValueCollection
[Microsoft.SharePoint.SPFieldLookupValue] $lookupvalue = New-Object Microsoft.SharePoint.SPFieldLookupValue
$lookupvalue.LookupId = 1
$lookupvalue.LookupId = 2
$itemValues.Add($lookupvalue)
$CMRSItems["Event Type"] = $itemValues
$CMRSItems.Update()
I was expecting the LookupID 1 and 2 to update but it doesn't. When i specify LookupId = 1 it works
What am i doing wrong.
Thanks in Advance
updating multivalues
$lookupvalue = GetLookUpValues -val $number
#Write-Host $lookupvalue
[Microsoft.SharePoint.SPFieldLookupValueCollection] $itemValues = New-Object Microsoft.SharePoint.SPFieldLookupValueCollection
[Microsoft.SharePoint.SPFieldLookupValue] $lookupvalue = New-Object Microsoft.SharePoint.SPFieldLookupValue
#sample lookup values adding to collection:
#1;#Open
#2;#Closed
$itemValues.Add($lookupvalue)
$CMRSItems["Event Type"] = $itemValues;
$CMRSItems.Update();
Getting error : Exception calling "Update" with "0" argument(s): "Invalid look-up value