6

I have created a list of links through Visual Studio. Now I want to add items to that list. How can I do it through visual studio itself?

I am using visual studio 2013.

  • Can you put some sample code about what you are doing, so we can help you more. – Milind Dec 20 '13 at 16:59
8

If you add list using ListInstance then you can add items using ListInstance file:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <ListInstance Title="LinkList" OnQuickLaunch="TRUE" TemplateType="170" FeatureId="Your feature id" Url="Lists/LinkList" Description="Your description">
    <Data>
      <Rows>
        <Row>
          <Field Name="Title">About</Field>
          <Field Name="Description">Description</Field>
          <Field Name="LinkLocation">http://testlink.com</Field>
          <Field Name="BackgroundImageLocation">
            /sites/Images/tile_about.png</Field>
          <Field Name="LaunchBehavior">New tab</Field>
          <Field Name="Order">2</Field>
        </Row>
      </Rows>
    </Data>
  </ListInstance>  
</Elements>
  • Is this to be write inside Elements.xml inside ListInstance file? I tried, but getting this error: The element 'Elements' in namespace 'schemas.microsoft.com/sharepoint' has invalid child element 'Data' in namespace 'schemas.microsoft.com/sharepoint'. – Praveen Prasannan Dec 23 '13 at 4:27
  • Yes in Elemets.xml of ListInstance file. You can make sure that ListInstance element have child element Data msdn.microsoft.com/en-us/library/office/… – Andrey Ungur Dec 23 '13 at 8:09
  • The problem was that I created lists as type links. For that data element was not available. Now I created with list. Any way we can make list items as hyperlink. – Praveen Prasannan Dec 23 '13 at 9:18
  • How can I add the Images in the Picture Library with the VS2012? – Ram Oct 21 '16 at 5:42

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.