Friday, August 29, 2008

Configuring site after site creation

SharePoint doesn't support any event that fires before and after site creation but in many cases you want one of the following:
1. You want to execute some code after site is created.
2. You want to redirect site creator to a custom designed configuration page once site is created.

There are various ways to do it but site definition core file ONET.xml support a special node 'ExecuteUrl' which basically takes a valid Url parameter and redirects the site creator to that Url once site is instantiated.

Snippet from ONET.xml:

<ExecuteUrl Url="_layouts/[%=System.Threading.Thread.CurrentThread.CurrentUICulture.LCID%]/customsettings.aspx"/>