SharePoint of the Day #58

When creating your own site definitions you can set the ProvisionAssembly and ProvisionClass to have .NET code fired when a new site is created. your class should inherit from the SPWebProvisioningProvider class.

This is useful for example if you want to create a site hierarchy as part of the site creation. In MOSS, the Publishing portal is set up using the ProvisionAssembly and ProvisionClass.

You can also optionally set the ProvisionData, which will be passed to the ProvisionClass. Here is some example code:

public class MySiteSetup : SPWebProvisioningProvider
{
public override void Provision(SPWebProvisioningProperties props)
{
string data = props.Data;
}
}

Post to Twitter Post to Delicious Delicious Post to Digg Digg This Post

Posted under Developer

This post was written by spotd on June 19, 2009

Tags:

Like this tip? Hate it? Vote here

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

1 Comment so far

  1. Sandeep June 19, 2009 7:00 pm

    One limitation being, you cannot set list properties in this method , as they might be get provisioned after this event is fired.

What do you think if this tip?

Name (required)

Email (required)

Website

Comments

More Blog Post

Previous Post: SharePoint of the Day #57