Client wants additional list for the future release. “Nobig deal” – you think – it will take maximum 2h. You add list to the package definition and instance of the list, deploy it… And you see that new list have the exact same columns that the previous one, created few weeks ago, have. You double check the Content Type ID, XMLs – you don’t have any idea why it is happening and nobody sees the source of the problem..
- After the deployment at least two SharePoint lists have the exactly same columns and views
- When reopening solution with Visual Studio additional feature are added; each of these feature contains only one list
All declaratively created lists probably have been placed in the same feature and have the same TemplateTypeId.
Assign every list different TemplateTypeId
<?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <ListInstance Title="..." OnQuickLaunch="..." TemplateType="1000" Url="..." Description="..."> </ListInstance> </Elements>
<xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <ListTemplate Name="..." Type="1000" BaseType="..." OnQuickLaunch="..." DisplayName="..." /> <Elements>
Suggestion: use numbers > 1000 and omit those already in use.
Accoring to the ListTemplate element definition on MSDN and its Type attribute description
This identifier must be unique within the feature, but need not be unique across all feature definitions or site definitions.
Otherwise VS will create new feature and place the list XML files there. But why it behaves that way? For that I have no answer.
What to look out for
There are rumors that using TemplateTypeId outside of the defined pool causes some missing functionality
Despite the fact I’ve never had such problems I think it is worth knowing.