Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Feature Stapling additional view columns - No FeatureActivated or WebProvisioned events, so where?

$
0
0

The problem I'm having is that I want to add a new column to all document views. It's simple enough to make a feature to do this and manually install and activate it. The problem is that it needs to be automatically applied to any new sites created including the first site for new web applications.

Stapling is easily accomplished and the new feature shows up where expected for all existing sites when deployed and can be activated to work as expected. It also get added to all new sites including the initial site collection but has no effect in that case.

I tried both at the site and web scopes and the results were the same.

The FeatureActivated event in the feature event receiver is the obvious location for a new feature and works just fine when applied to an existing web site. However, for new site collections the feature is activated prior to the content creation so the views being updated don't exist when the event is fired making the code ineffective when stapled and associated with the new site collection's template.

The WebProvisioned event doesn't fire at all for the first site collection created for a new web application. Apparently, the event isn't registered until after creation takes place so it won't fire in that case. Again, this makes the event ineffective.

So, where can I put code to be executed after any site collection is created including the first one for a new web application?



Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>