title: To save a user name into a people field
body: <p>To save a user name into a people field:</p>
  
  <p>Provided a people editor control in my custom form and saved each resolved entity as follows:</p>
  
  <pre><code> if (currentPeopleEditor.Entities.Count != 0)
   {
   SPFieldUserValueCollection userCollection = new SPFieldUserValueCollection();
   for (int index = 0; index &lt; currentPeopleEditor.ResolvedEntities.Count; index++)
   {
    PickerEntity ObjEntity = (PickerEntity)currentPeopleEditor.ResolvedEntities[index];
    userCollection.Add(new SPFieldUserValue(objSPWeb,Convert.ToInt32(ObjEntity.EntityData["SPUserID"]), ObjEntity.Key));
    }
    newItem[Field.Key.ToString()] = userCollection;
    }            
  </code></pre>
  
  <p>It was working very fine until some user stated getting this exception:
           "Invalid Look-up Value</p>
  
  <p>A look-up field contains invalid data, Please check the value and try again."</p>
  
  <p>On investigating we found that this error was occurring because
           ObjEntity.EntityData["SPUserID"]) was returning as null.</p>
  
  <p>It was happening because the requirement is to save some users name who don't access this site collection but they are member of corporate AD system.</p>