So, you want to provide a look-up in a SharePoint Site Definition and you’d quite like to provide your users with some options? (i.e. items in the source list)
Firstly you’re probably interested in this post from Josh Gaffy about adding a lookup column declaratively using CAML.
Next you’ll be wanting to use this snippet to declare your source list and the data it will contain.
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <ListInstance FeatureId="89CA0ED1-8E9B-48fa-8C4D-CB406544D662" TemplateType="100" Title="Option List" OnQuickLaunch="TRUE" Description="Choices" Url="Options" > <Data> <Rows> <Row> <Field Name="Title">Foo</Field> </Row> <Row> <Field Name="Title">Bar</Field> </Row> <Row> <Field Name="Title">Fred</Field> </Row> <Row> <Field Name="Title">Mildred</Field> </Row> <Row> <Field Name="Title">Karl</Field> </Row> <Row> <Field Name="Title">Lenny</Field> </Row> </Rows> </Data> </ListInstance> </Elements>
Hope that someone finds this useful.
Thanks bro!
thanks but I want to put values in a mutiple values field, I tried
value1;value2;value3
It does not work. Do you know How to complete that?
The default separator for multivalued items is ;# so value1;#value2;#value3;# may work for you. That said though if your multivalued item is a lookup to another list you’ll need to provide the ID of the item you’re looking up to as well as the value. I can’t recall the pattern for that off the top of my head but if you get stuck then inspect an item you created via the web ui using SharePoint Manager.