How to get all possible values for SPFieldLookup

Posted by Anton Polyakov on Stack Overflow See other posts from Stack Overflow or by Anton Polyakov
Published on 2010-03-31T07:35:38Z Indexed on 2010/03/31 10:03 UTC
Read the original article Hit count: 385

Filed under:
|

Hello!

I have a lookup field in sharepoint which just references another list. I wonder how do I programatically enumerate all possible values for this field? For example, my lookup field "Actual City" refers list "Cities" and column "Title", I have 3 cities there. In code I would like to get list of all possible values for field "Actual City", smth like (metacode, sorry):

SPFieldLookup f = myList["Actual City"];
Collection availableValues = f.GetAllPossibleValues();
//this should return collection with all cities a user might select for the field

© Stack Overflow or respective owner

Related posts about sharepoint

Related posts about spfield