1

I have a SharePoint Hosted App. Now I am adding a new list using "Add -> New Item -> Lists".

List got created. But my question is, I want to add an item so that when I install my SharePoint App, the list should create with that default item.

Is this possible? If yes please suggest some work arounds.

3

Yes it absolutely possible like the good ole days of SSOM.

Go to the your listinstance.xml > elements.xml as below:

enter image description here

Then inside the xml, structure add your data as below:

<ListInstance Title="List1"
                OnQuickLaunch="TRUE"
                TemplateType="100"
                Url="Lists/List1"
                Description="My List Instance">

    <Data>
      <Rows>
        <Row>
          <Field Name="Title">Test1</Field>
        </Row>
        <Row>
          <Field Name="Title">Test2</Field>
        </Row>
        <Row>
          <Field Name="Title">Test2</Field>
        </Row>
      </Rows>
    </Data>

  </ListInstance>

Here, the default values should be inside <Data><Rows><Row>. After that, just deploy your app and default values would be present.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.