When creating Microsoft SharePoint lists through Visual Studio sometimes you want to have default data added to the list. In the case where you are using the Visual Studio List Designer you need to add this data into the Elements.xml file of your list instance. Inside the List Instance tag in your file you will need to add a Data tag and inside that a Rows and Row tag, each Row is an item in the SharePoint list. Inside your Row tag you can add in the fields of the list with their values like below:

When adding items this way SharePoint will create duplicates of the items each time the list is deployed to the site. To prevent this from happening you can specify the Id of the item.

You should now have your items in your list without any duplicates!

If you need any bespoke development help, just reach out. 

Get Up To Speed With SharePoint 2019!

Download Our FREE eBook...

 

Download SharePoint 2019 eBook

Comments