jeudi 29 janvier 2015

Add user to a new list item



I would like to add to a list a new item with a User or Group field. The code is this:



ListItemCreationInformation listItemCreationInformation = new ListItemCreationInformation();

ListItem item = list.AddItem(listItemCreationInformation);


User u = context.Web.EnsureUser("Name Surname");

item["MyUserField"] = u;
item.Update();


Do you know what's wrong or what I should do?








0 commentaires:

Enregistrer un commentaire