R – Create list in existing site collection from a feature

camlmosspublishingsharepoint

I have created a feature, a publishing site, in Visual Studio to MOSS – this feature contains a masterpage, some page-templates, some site columns (grouped to match each page-template) and som custom list templates etc. I have also created a site collection, some sites and pages based on my feature.

Now I have upgraded the code in my feature – I wanted a ListInstance to be created based on my custom list template. When I have upgraded my SharePoint (using WSPBuilder), the ListInstance and default data are visible if I create a new site collection, but existing site collection does not get the ListInstance and data. Is there anything I can do to update existing site collections to contain the ListInstance when upgrading?

Best Answer

Unfortunately your only choice here is to programmatically create the list in all existing sites in the feature's FeatureActivated method in a feature event receiver. This is a gaping hole in sharepoint's deployment model, and a painful one at that.

-Oisin