0

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?

3

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

  • So my best shot for this to work as intended would be to create EventReceivers which will do the list alterings on the SiteProvisioned event, yes? – user2536 Feb 13 '14 at 8:56
  • 1
    What type of alterings are we talking about? I'm guessing changes based on e.g. the name of the site created? If so, yes, some sort of event receiver like WebProvisioned (if it will fire) or ListAdded – Robert Lindgren Feb 13 '14 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy