none
Populate a List in List Instance by XML : how to fill a multiple look up value Field RRS feed

  • Question

  • I am populating a list instance in the Elements.xml with a multiple look up value Field that I called 'groups'

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <ListInstance Title="Mytitle"
                    OnQuickLaunch="TRUE"
                    TemplateType="10006"
                    Url="Lists/title"
                    Description="my  description">
        <Data>

          <Rows>
            <Row>
              <Field Name="Title">title1</Field>
              <Field Name="text"> value1</Field>
              <Field Name="groups">group1;group2;group3</Field>
            </Row>

    <Row>
              <Field Name="Title">title1</Field>
              <Field Name="text"> value1</Field>
              <Field Name="groups">group2;group3</Field>
            </Row>

    <Row>
              <Field Name="Title">title1</Field>
              <Field Name="text"> value1</Field>
              <Field Name="groups">group1</Field>
            </Row>

           
          </Rows>
        </Data>
      </ListInstance>
    </Elements>

    That occurs an error, do you know if it is possible and how to do that???

    mardi 29 octobre 2013 10:09

Réponses

  • Hi,

    yes it's possible, you need to declare in you list scheme the field as lookup type.

    And in your elements.xml enter the lookup value as key/pairs

    Like: <Field Name="MyField">1;#group1;2#group2;3;#group3</field>

    Have fun ;)


    <a href="www.vlecerf.fr">Mon blog sur SharePoint</a><br/> <a href="http://fr.viadeo.com/fr/profile/valentin.lecerf"><img src="http://vlecerf.fr/wp-content/themes/Metro/images/social/viadeo.png" height="5%" width="5%" alt="viadeo"></a>&nbsp;&nbsp;<a href="http://twitter.com/IoX_"><img src="http://vlecerf.fr/wp-content/themes/Metro/images/social/twitter.png" height="5%" width="5%" alt="twitter"></a>&nbsp;&nbsp;<a href="http://fr.linkedin.com/pub/valentin-lecerf/3a/547/238"><img src="http://vlecerf.fr/wp-content/themes/Metro/images/social/linkedin.png" height="5%" width="5%" alt="linkedin"></a><br/> <p>MCP | Microsoft Certified Professional - SharePoint 2010 Administrator & Developer Certified</p>

    • Proposé comme réponse Valentin Lecerf mardi 29 octobre 2013 10:22
    • Marqué comme réponse viv75 mardi 29 octobre 2013 11:14
    mardi 29 octobre 2013 10:22

Toutes les réponses

  • Hi,

    yes it's possible, you need to declare in you list scheme the field as lookup type.

    And in your elements.xml enter the lookup value as key/pairs

    Like: <Field Name="MyField">1;#group1;2#group2;3;#group3</field>

    Have fun ;)


    <a href="www.vlecerf.fr">Mon blog sur SharePoint</a><br/> <a href="http://fr.viadeo.com/fr/profile/valentin.lecerf"><img src="http://vlecerf.fr/wp-content/themes/Metro/images/social/viadeo.png" height="5%" width="5%" alt="viadeo"></a>&nbsp;&nbsp;<a href="http://twitter.com/IoX_"><img src="http://vlecerf.fr/wp-content/themes/Metro/images/social/twitter.png" height="5%" width="5%" alt="twitter"></a>&nbsp;&nbsp;<a href="http://fr.linkedin.com/pub/valentin-lecerf/3a/547/238"><img src="http://vlecerf.fr/wp-content/themes/Metro/images/social/linkedin.png" height="5%" width="5%" alt="linkedin"></a><br/> <p>MCP | Microsoft Certified Professional - SharePoint 2010 Administrator & Developer Certified</p>

    • Proposé comme réponse Valentin Lecerf mardi 29 octobre 2013 10:22
    • Marqué comme réponse viv75 mardi 29 octobre 2013 11:14
    mardi 29 octobre 2013 10:22
  • Merci!!!
    mardi 29 octobre 2013 11:13