Search This Blog

Wednesday, July 11, 2012

Value cannot be null. Parameter name: source

on updating a list item an error was thrown:

i.e. Value cannot be null: Parameter name: Source:

Reason:  The value supplied to the Lookup column were not correct.

listItem.LookFieldName = new SPFieldLookupValue(Id, Title)
where Id is the Id of the item in destination list and Title is the value of the Title field.

If the value of Id is wrong this error is generated.

Solution: Obvious: Provide the correct value for Id from destination list.