First published on TECHNET on Mar 13, 2013
This blog post is a contribution from Bharat Rathod, an engineer with the SharePoint Developer Support team.
In this post, I’ll show you how to use UpdateListItems method of the Lists.asmx web service to modify a ListItem which has multi-value people and group column. Most of us tend to fall into trouble while creating the batch element.
Here’s the detailed description of the sample code.
One of the most important part of this code is creating the batch element. In order to add users to a multi-value people and group field, we need to get the UserID from the SPWeb object. In the code, I’ve used the following statements:
This code finds out the user’s identifier (UserID) of whatever user you want to add to the multi-value field (in this case, it’s contoso\user1 ).
The above code snippet tries to add two users to the column named “manyusers”. Use the ;# symbols before every entity and then end the string with ;# again. One common mistake we tend to do is to miss out on the ;# towards the end of the string.
Try the above sample to get users added to a multi-value people and group field.
Hope this short blog post is of some help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.