Question

We have recently upgraded from SharePoint 2007 to 2010 and we aren't yet ready to train users on the new interface, so I've created a SPFeatureReceiver that will set the site template back to the 2007 look.

public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
    SPWeb web = (SPWeb)properties.Feature.Parent;
    web.UIVersion = 3;
    web.UIVersionConfigurationEnabled = true;
    web.Update();
}

However this executes when the feature is activated and sets all sites to this which may end up being okay, but would like some guidance.

Is there a way to only execute this or something similar when a site is created and not just when the feature is activated, leaving any sites alone that are already created?

Instead, is the idea that the feature is technically activated when a site is created and therefore will execute when a site is created and can't do anything about this for existing sites?

Was it helpful?

Solution

You should be able to use event recievers to do this, more specifically the SPWebEventReciever.

From Microsoft:

An event receiver is a piece of managed code that responds to SharePoint events when specific triggering actions occur on a SharePoint object. Triggering actions include activities such as adding, updating, deleting, moving, checking in, and checking out.

References:

http://msdn.microsoft.com/en-us/library/gg749858(v=office.14).aspx

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spwebeventreceiver(v=office.14).aspx

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