Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

i have a list with a field (Customers) of people and group type with multiselection set to true i want to fetch the IEnumerable list of ids from that field as that field contains value in the format somewhat like (3;#;username)

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You can iterate through the SPFieldUserValueCollection and obtain the id value like so:

SPFieldUserValueCollection collection = new SPFieldUserValueCollection(web, listItem["Customers"]);
foreach (SPFieldUserValue value in collection)
{
    value = value.LookupId
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.