When working with SharePoint list you should often update field values, like lookup fields (SPFieldLookup) and user fields (SPFieldUser, that is a subclass of the former one). In these cases you have to work with value types of SPFieldLookupValue (or SPFieldLookupValueCollection for multi valued fields) or SPFieldUserValue (SPFieldUserValueCollection for multi valued fields).
If you want to update these type of fields, you should know the ID of the referenced list item or user only. Jinal Patel shows an example for that in this post using the UpdateListItems method of the Lists web service.
You can do the same when updating the items using the object model either through updating an individual item or using the batch update method.
For the sake of this example I’ve added a single value lookup field called Location to a Task list on my site. This field refers to another list of the same site that contains city names in the referenced field.
The following code updates the Location field (SPFieldLookup) and the AssignedTo field (SPFieldUser) of the task list item having ID = 1.
Including the name part of the lookup field has really no effect; it is simply ignored, for example:
item["Location"] = new SPFieldLookupValue(1, "abcdefgh");
The above code has the same result as using null as the lookup name, even if the name part is not matching the real value of the remote field.
You can do the same using the ProcessBatchData method. The following example updates the task list item having ID = 3.
Including the name part of the lookup field has no effect as in the case of the single item update above.
This would be identical with the previous version of batch update without the name part, even if the name part is not matching the real value of the remote field.
This behavior of the lookup and user fields is very nice, as if it required the name part as well would mean we should do an extra lookup in the remote list for the value of the referenced field.