In this article we will be seeing how to get the SPFieldUserValueCollection values using a Client Object Model in SharePoint 2010. Description: I have a custom list named SPList which contains the following columns and data The MultiUser column is created using a Person or Group field type and Allow Multiple Selections option is enabled.
In this we will see how to get the MultiUser column value for a particular item which is a SPFieldUserValueCollection using a Client Object Model. Client Object Model:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.SharePoint.Client; using System.Net;
namespace FieldUserValue { class Program { static void Main(string[] args) { ClientContext clientContext = new ClientContext("https://serverName:2010/"); List oList = clientContext.Web.Lists.GetByTitle("SPList"); ListItem item = oList.GetItemById(12); clientContext.Load(item); clientContext.ExecuteQuery(); foreach (FieldUserValue userValue in item["MultiUser"] as FieldUserValue[]) { Console.WriteLine(userValue.LookupValue.ToString()); } Console.ReadLine(); } } }
Build the solution.
Hit F5.
Output:
Note: Please refer FieldUserValue for more information.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: