Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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

share|improve this answer
    
Nice find. I'll take a look at this and see if I can get something working –  Kirk Apr 29 '13 at 17:36
    
Worked perfectly. Thank you. –  Kirk Apr 29 '13 at 18:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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