Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

[SharePoint 2013] user field in list item cannot be updated via client object model code

$
0
0

Hello Support,

I am struggle with a problem to update the user field (Responsible Person) in list item. Basically, I used following code:

 ListItem item = list.GetItemById(26);
 ctx.Load(item);
ctx.ExecuteQuery();

FieldUserValue userValue = new FieldUserValue();
User user = ctx.Web.EnsureUser("<logon name>");
ctx.Load(user);
ctx.ExecuteQuery();
userValue.LookupId = user.Id;

item.FieldValues["Responsible_x0020_Person"] = userValue;
item.Update();
ctx.ExecuteQuery();

I have debugged the item line by line. userValue.LookupId can be retrieved successfully. Before running ctx.ExecuteQuery, "Responsible Person" field was allotted the value. But after execution, the value was changed to null. Following is what I have referred:

https://blogs.msdn.microsoft.com/kaevans/2013/11/30/setting-a-sharepoint-person-or-group-field-value-with-csom/

http://passionatetechie.blogspot.com/2012/01/how-to-set-people-and-group-column.html

Appreciate your effort to have a check, and looking forwarding to your reply

Regards,

Freddie


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>