8

So I have been able to populate rows with Lookup type fields as such:

<ListInstance ... > <Data> <Rows> <Row> <Field Name="LookupColumn">2;#LookupValue</Field> </Row> </Rows> </Data> </ListInstance> 

But how do I populate multiple values in the same manner for a LookupMulti typed field?

I can get one value, but have been unable to figure out how to populate more.

Relevant XML

Schema.xml

 <Field ID="{69FCEC38-3F15-48DB-891E-D76EF66A02A4}" Name="MultiLookupColumn" Type="LookupMulti" List="Lists/Target" ShowField="Title" Mult="true" DisplayName="MultiLookupColumn" Required="false"/> 

Elements.xml

<ListInstance ... > <Data> <Rows> <Row> <Field Name="MultiLookupColumn">1;#Value1;#2;#Value2</Field> </Row> </Rows> </Data> </ListInstance> 

I know the schema is right because I can add multiple items via the AddItem.aspx form.

Edit

The schema may be wrong. The form allows me to add multiple but when I do still only the first value displays.

1

3 Answers 3

10

Try 1;#LV1;#2;#LV2;#3;#LV3. Each item seperated by ;#

1
  • useful answer! note: no need to specify title, just ID means and it gets correct titles!
    – gdbdable
    CommentedNov 28, 2012 at 12:54
5

My problem was resolved by changing Mult="true" to Mult="TRUE" but this was not what I asked.

2
  • Thank's a lot. But is really weird. What's the difference?
    – fallout
    CommentedJul 3, 2013 at 10:46
  • I still have no idea why, but I'm assuming it just doesn't parse the lowercase "true" correctly... for whatever reason... since this incident I've always used all uppercase "TRUE"s everywhere and haven't had any problems like this again. Truly weird.CommentedJul 3, 2013 at 12:54
3

If you are only using id's, it worked for me only with:

1;#;#2;#;#3

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.