Create a subsite programmatically

STEP 1: Create subsite programmatically

First I set a few constants:
image
LOCALE_ID : in my case it had to be Dutch.
SITE_NAME: the url of the site
SITE_TEMPLATE: Choose what kind of site you want to make from the table below.

Available site templates

Site Template Names

Team Site

STS#0

Blank Site

STS#1

Document Workspace

STS#2

Blog

BLOG#0

Group Work Site

SGS#0

Visio Process Repository

VISPRUS#0

Basic Meeting Workspace

MPS#0

Blank Meeting Workspace

MPS#1

Decision Meeting Workspace

MPS#2

Social Meeting Workspace

MPS#3

Multipage Meeting Workspace

MPS#4

Assets Web Database

ACCSRV#1

Charitable Contributions Web Database

ACCSRV#3

Contacts Web Database

ACCSRV#41

Issues Web Database

ACCSRV#6

Projects Web Database

ACCSRV#5

Document Center

BDR#0

Records Center

OFFILE#1

Business Intelligence Center

BICenterSite#0

My Site Host

SPSMSITEHOST#0

Personalization Site

SPSMSITE#0

Enterprise Search Center

SRCHCEN#0

Basic Search Center

SRCHCENTERLITE#0

FAST Search Center

SRCHCENTERFAST#0

Enterprise Wiki

ENTERWIKI#0

Publishing Portal

BLANKINTERNETCONTAINER#0

Publishing Site

CMSPUBLISHING#0

Publishing Site With Workflow

BLANKINTERNET#2

Next I made a feature and added a feature event handler. This is what I wrote in FeatureActivated.
image

And to make it really clean and tidy, I deleted the subsite when the feature is being deactivated.
image

Reacties

Populaire posts