I have a feature which on activation has to create a list called Scanners. Only one column from the list (Title) is actually used in my app. The list needs to be pre-populated with some values. To fill in the values I used the ListInstance's Elements.xml, so now it looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListInstance Title="Scanners"
TemplateType="10000"
Url="Lists/Scanners"
Description="Scanners">
<Data>
<Rows>
<Row>
<Field Name="Title">DevScanner</Field>
</Row>
<Row>
<Field Name="Title">ProdScanner</Field>
</Row>
<Row>
<Field Name="Title">TestScanner</Field>
</Row>
</Rows>
</Data>
</ListInstance>
</Elements>
The list instance is created at the Site(Web) level. On Feature activation, the list instance should be created only if the site doesn't already contain a list with the same name (Scanners). The current behavior does this, but with one problem. On each activation, the data gets added again to the existing list, so I end up with lots of duplicate rows. How can this be prevented?
The client's specs don't allow me to delete the list on feature deactivation. I tried fiddling with the Deployment Conflict Resolution setting, with no success.