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 multiple lookup field, and when I do this:

string myValue = oItem["MyLookupField"];

I get this string back:


or a real example:


as you can see not the most logical string to split. Surely there must be a better way to get a splitable string back from sharepoint for a lookup field.

I would expect something like:

"5;C3|15;P3" (for example)

Anyone know how to get a better string back for a lookup field?

share|improve this question
up vote 14 down vote accepted

Instead of parsing them manually, try using the SPFieldLookupValue class instead:

MSDN: SPFieldLookupValue

or the SPFieldMultiChoiceValue class:

MSDN: SPFieldMultiChoiceValue

share|improve this answer
I happen to have written an article on this very subject a few moments ago. :) – Stuart Pegg Aug 16 '11 at 20:51

The delimiter cannot be changed and is found in the SPFieldMultiChoiceValue.Delimiter property.

share|improve this answer

you can write own function like this

var Result = Regex.Split(data, ";#", RegexOptions.ExplicitCapture) .ToList().aggregate((x,y)=>x+";"+y+"|");

This solve your problem

share|improve this answer
-1 For that to work you have to know the delimiter – Johan Leino Apr 13 '11 at 10:02

Your Answer


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.