Home > SharePoint, site template, stp > Create Site Template Pro-grammatically

Create Site Template Pro-grammatically


We have many a time saved a SharePoint site template using the SharePoint User Interface. But did you know that we can save the site template pro-grammatically as well. Let me tell you how…

using(SPSite siteCollection = new SPSite("http://{yoursite}"))
{
using(SPWeb web = siteCollection.RootWeb)
{
web.SaveAsTemplate("TemplateFileName.stp", "Template Title", "Template Description.", true);
}
}
Advertisements
Categories: SharePoint, site template, stp
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: