sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Cannot populate the list with some initial data. You do this by adding the following Data element markup as a child element of the ListInstance element

Open duncanspeidel opened this issue 7 years ago • 17 comments

When I add the following to my ListInstance element it fails. <Data> <Rows> <Row> <Field Name="Title">Tom Higginbotham</Field> </Row> <Row> <Field Name="Title">Satomi Hayakawa</Field> </Row> <Row> <Field Name="Title">Cassi Hicks</Field> </Row> <Row> <Field Name="Title">Lertchai Treetawatchaiwong</Field> </Row> </Rows> </Data> It fails with: Severity Code Description Project File Line Suppression State Error Error occurred in deployment step 'Install SharePoint Add-in': Feature definition with Id 3d9f595f-0f21-4a70-a5b8-214fcf87ad8e failed validation, file 'TQM_TQM New Employee Orientation\NewEmployeeOrientation\Elements.xml', line 16, character 4: The element 'Elements' in namespace 'http://schemas.microsoft.com/sharepoint/' has invalid child element 'Data' in namespace 'http://schemas.microsoft.com/sharepoint/'. List of possible elements expected: 'ContentType, ContentTypeBinding, Field, CustomAction, Module, ListInstance, ListTemplate, Receivers, Workflow, WebTemplate, WorkflowAssociation, PropertyBag, ClientWebPart, BdcModel' in namespace 'http://schemas.microsoft.com/sharepoint/'. TQM 0

What am I missing?


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

duncanspeidel avatar Aug 14 '19 18:08 duncanspeidel

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

msft-github-bot avatar Aug 14 '19 18:08 msft-github-bot

Running studio 2019.

duncanspeidel avatar Aug 14 '19 18:08 duncanspeidel

Can you share your full ListInstance Elements.xml

Based on the error it looks like you are setting this inside the List Template, not the List Instance.

file 'TQM_TQM New Employee Orientation\NewEmployeeOrientation\Elements.xml',

As per the documentation you linked, it should be in the list instance NewEmployeesInSeattle not NewEmployeeOrientation.

  1. Open the elements.xml file that is a child of the list instance NewEmployeesInSeattle (not the elements.xml that is a child of the list template NewEmployeeOrientation).

  2. In this file, populate the list with some initial data. You do this by adding the following Data element markup as a child element of the ListInstance element.

bcameron1231 avatar Aug 14 '19 20:08 bcameron1231

I opened Elements.xml in 'TQM_TQM New Employee Orientation\NewEmployeeOrientation\NewEmployeeSeattle\Elements.xml' (see attachment named shot1) and added the fields and it failed with the same error. I also tried Shot1. I also tried editing NewEmployeeOrientation\Elements.xml (see attachment named shot2).
shot2.

Screenshot called choices shows what I see when enter a '<'. Choices.

The Elements.xml that is sub to NewEmployeeInSeattle contians:

The Elements.xml that is for NewEmployeeOrientation contains:

<ListTemplate
    Name="NewEmployeeOrientation"
    Type="100"
    BaseType="0"
    OnQuickLaunch="TRUE"
    SecurityBits="11"
    Sequence="410"
    DisplayName="NewEmployeeOrientation"
    Description="My List Definition"
    Image="/_layouts/15/images/itgen.png"/>

Both have the same auto-complete options.

duncanspeidel avatar Aug 15 '19 14:08 duncanspeidel

The Elemements.xml for your NewEmployeeInSeattle didn't show up. Can you re-add it please?

Also, I have ran through the tutorial and it works for me.

image

So, hopefully we can find the issue in your Elements.xml

bcameron1231 avatar Aug 15 '19 16:08 bcameron1231

duncanspeidel avatar Aug 15 '19 16:08 duncanspeidel

Please take a picture or wrap your XML in Code Tags, or else it wont show up. Thanks!

bcameron1231 avatar Aug 15 '19 16:08 bcameron1231

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <ListInstance Title="New Employees in Seattle" OnQuickLaunch="TRUE" TemplateType="100" Url="Lists/NewEmployeesInSeattle" Description="The new employees in Seattle"></ListInstance>

</Elements>

duncanspeidel avatar Aug 15 '19 17:08 duncanspeidel

This is an incomplete list instance.

I would like to see your Elements.xml with the Data (of which you say isn't working)

bcameron1231 avatar Aug 15 '19 17:08 bcameron1231

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <ListInstance Title="New Employees in Seattle" OnQuickLaunch="TRUE" TemplateType="100" Url="Lists/NewEmployeesInSeattle" Description="The new employees in Seattle"></ListInstance>
  <Data>
    <Rows>
      <Row>
        <Field Name="Title">Tom Higginbotham</Field>
      </Row>
      <Row>
        <Field Name="Title">Satomi Hayakawa</Field>
      </Row>
      <Row>
        <Field Name="Title">Cassi Hicks</Field>
      </Row>
      <Row>
        <Field Name="Title">Lertchai Treetawatchaiwong</Field>
      </Row>
    </Rows>
  </Data>
  
</Elements>
![error](https://user-images.githubusercontent.com/16256174/63114761-9987eb80-bf63-11e9-979c-70befb6d68f5.png)

duncanspeidel avatar Aug 15 '19 17:08 duncanspeidel

Thank you. So the problem is, you have not followed the Tutorial directions correctly.

  1. In this file, populate the list with some initial data. You do this by adding the following Data element markup as a child element of the ListInstance element.

Your data needs to be a child element of the ListInstance Element, not a sibling.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <ListInstance Title="New Employees in Seattle" OnQuickLaunch="TRUE" TemplateType="100" Url="Lists/NewEmployeesInSeattle" Description="The new employees in Seattle">
  <Data>
    <Rows>
      <Row>
        <Field Name="Title">Tom Higginbotham</Field>
      </Row>
      <Row>
        <Field Name="Title">Satomi Hayakawa</Field>
      </Row>
      <Row>
        <Field Name="Title">Cassi Hicks</Field>
      </Row>
      <Row>
        <Field Name="Title">Lertchai Treetawatchaiwong</Field>
      </Row>
    </Rows>
  </Data>

</ListInstance>
</Elements>

bcameron1231 avatar Aug 15 '19 17:08 bcameron1231

@duncanspeidel Are we able to close this ticket?

bcameron1231 avatar Aug 16 '19 13:08 bcameron1231

Thank you for your help. I had the in the wrong place. Everything works now.

duncanspeidel avatar Aug 16 '19 13:08 duncanspeidel

I had the </ListInstance> in the wrong place. You can close the ticket.

duncanspeidel avatar Aug 16 '19 13:08 duncanspeidel

@andrewconnell This ticket can be closed

bcameron1231 avatar Aug 16 '19 13:08 bcameron1231

Thanks @bcameron1231 In the future, you can use #please-close when you tag me.

andrewconnell avatar Aug 16 '19 13:08 andrewconnell

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

msft-github-bot avatar Jan 23 '20 18:01 msft-github-bot