Friday, July 4, 2008

Programmatically Creating Site Collection in SharePoint

It is possible to create site collections programmatically. The Site Collection creation can be accomplished in the following ways

1) Using SharePoint Object Model
2) Using Central Admin’s Admin Web Service

Creation Site Collection using SharePoint Object Model

See the following code snippet, which uses SharePoint Object Model to create site collection.



Creating Site Collection using Admin Web Service

The Admin Web Service of Central Admin has the following web methods



The following code snippet uses “CreateSite” web method to create a site collection.
After the successful creation of site collection, this web method returns the URL of the newly created site.

1 comment:

Solhar said...

I have created a new sitecollection using code like this.

But for some reason I am not able to inherit permissions on a subsite created in this sitecollection.

What could be wrong?