0

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?

2

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

  • Nice find. I'll take a look at this and see if I can get something working – Kirk Apr 29 '13 at 17:36

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.