SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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.