Question

I have some site definitions in which I have added multiple lists into the <Lists> tag and then I've added a stapling feature which will trigger a series of web-scoped features when sites are created using one of these site definitions.

This all works fine and dandy, however in some features I need to alter some views in some of the lists. I have 30+ lists created on site creation and 20+ of these needs to have different columns added to them based on their base content type and what site definition is used.

I've avoided creating custom list definitions as all of the lists are just document libraries, task lists, calendars etc. which needs to have a few extra columns added, but it all depends on the site definitions used.

The issue I'm facing is the features can't seem to find the lists and throws

"List Name does not exist on Site Name Here."

exceptions. But if I add the lists using list instances instead and adding them through another feature, then my list altering features can find them.

So I was wondering if the lists in the <Lists> tag of a site definition gets created before or after the features have been activated, and if it's the latter, how come they throw this exception?

Was it helpful?

Solution

If I remember correctly the flow is:

  • Site Collection Scoped Features
  • Web Scoped Features
  • Lists
  • Modules

Your stapled features would be shot in after Site collection scoped features or Web scoped features (depending on scope) and hence the lists is not guaranteed to be created before the lists.

Found a source here: http://blogs.msdn.com/b/chrischiaro/archive/2011/01/18/sharepoint-site-definition-provisioning-order.aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top