.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

how to create site collection by using custom template through programmatically?

Posted By:      Posted Date: September 02, 2010    Points: 0   Category :SharePoint
hi all, how we can create site collection by using custom template through programmatically? please give me some suggestions. where we need to save this custom template... thanks in advance..

View Complete Post

More Related Resource Links

how to create site collection by using custom template through programmatically?

hi all, how we can create site collection by using custom template through programmatically? please give me some suggestions. where we need to save this custom template... thanks in advance..

is there any problem if i create a site collection through programmatically which web application ha

hi all, My web application have 2  types of authentication -- for internal users (windows authentication) and external users (Form based authentication). I am creating site collections through programmatically in the web application. so this site collection should have the permission as form based authentication for external users and windows authentication for internal users. is it possible are not? please give me some suggestions on creating site collections which have form based authentication and windows authentication. thanks in advance......

how to add custom site collection template in central admin site in SharePoint2010?

hi all, how can we add custom template in cendtral admin in sharepoint 2010? In 2007, we can add by using the stsadm tool addtemplate operation....but 2010 tremplate is saved as a solution file not a .stp file...so how we can add this template in central admin site in SharePoint 2010? Please give me some suggestions...... thanks in advance.....

Creating a dynamic site using custom template programmatically.



I have sites like




I have created Project1 as Template (Save as Template) and this template is available at http://kashyap Site Gallery > Solutions

http://kashyap/Team has a list called projects. I want to do custom workflow which is run by user manually(It is not problem). I want to create site programmatically  based on the template. I did some code Its

 private void codeCreateSite_ExecuteCode(object sender, EventArgs e)
      SPWeb web = workflowProperties.Web;

      SPListItem lst = workflowProperties.Item;
      string title = lst["Project Title"].ToString();
      string url = Common.UrlString(title);
      string desc = "Project from " + Common.GetFormatedValue(Convert.ToString(lst["Customer"

Create Custom Site Template & Deploy as Farm Solution


So I've seen a few posts and blogs about this, but nothing with the specific error I'm getting.  All I'm trying to do is create a custom site template from an existing site (now WSP), and make that custom template available in CA so I can create host-named site collections from that template in PowerShell.  Apparenly this was a lot easier in 2007, as you could just save your template as STP, and run some stsadm addsolution to get it in the farm.  With 2010, I've read there are 2 options:

  1. Install-SPWebTemplate
  2. Deploy via Visual Studio 2010

I've tried running Install-SPWebTemplate (which only takes CAB files), and NOTHING I do works.  I've created a cab from the WSP with makecab, I've renamed the WSP to CAB, and all I get is "cannot find or parse web template file".  So on to VS2010.

Using this article as a guide (http://msdn.microsoft.com/en-us/library/ff408263.aspx), I created a new 2010 Import existing solution project, left all items selected, and the import was successful.  I made a change or two to the ONET.xml to fix some things, and then I just try to deploy it to the farm.  Whether I set the URL to the root intranet site, or the CA URL, I get deployment conflict errors:

"The URL or

What's the "right" way to create a site template and inherit a custom master page?


Correct me if I'm wrong, but in 2007 whatever masterpage you had selected was saved in the site template and was re-created when a new site was created from said template.

It occurs to me that it's different in 2010.

Custom master pages from a site template aren't inherited and they don't keep the specified value when you ask it to before creating the template itself.

So, what's the "correct" way?  What's the difference in making a site template using a blank site or publishing site?

Here I thought I'd be able to make a site template and move on to my next project.

Thanks in advance!


Programmatically activating an admin-approved form template to a site collection?



I am currently programmatically generating infopath forms with code-behind, and for each generated form, I need to be able to host the form template as a content type. Since I have a farm solution, I know that I would usually have to publish manually to admin-approved form template as opposed to form libraries or content types directly and afterwards create content types which reference those form templates. I was wondering what I would need to do to achieve the following results:

1) Programmatically activate a form template to a site collection (this is the big question mark for me)

2) Programmatically generate a content type which references said form template (I believe I already have this part down using the SP Object Model)

The environment I am building in uses SharePoint 2010 Enterprise Edition, InfoPath2010, .NET 3.5, VS 2010.

Any assistance would be MUCH appreciated.

404 Page Not Found Error When Trying to Create a Site From a Custom Site Template


I just moved a site collection from a one server to another, and now I can't make copies of my sites using custom site templates.

The details of my site structure are in the next paragraph, in case they are relevant.
On the original server, I created custom templates for my sites, and checked the Include Content checkbox
when creating the templates. Everything works perfectly on that server. When I moved the whole site collection to another
server using stsadm backup/restore everything was there, including my customized web parts. But now I can't create new sites
from templates - and I'm I'm not trying to use templates created on the original server. I'm creating new templates on the new
server. It successfully creates the templates, but when I try to create a new site from one of those templates, I get a
"HTTP 404 Page Not Found" page. It succeeds in creating the new site, and the new site shows up in my navigation bar,
but when I click on the new site, I get a "404 Page Not Found" page.

On the original server, I created one top level site for my whole department. Under that, I have one subsite for each of our
external clients. Under each of those, I have one subsite for each project for that client. I used a Team site as my starting
point at each of the 3 leve

How to create root site collection using custom site defination ?


Hi All,

I have created custom site defination using vs2010. I want to create root site collection from central admin using my custom site defination on Sharepoint Foundation 2010. I also want to create some sub sites. I am not finding proper event where I write code to create sub sites.

This is argent. Please help me.

Thanks in Advance.  

"Duplicate content type name" error when trying to create a site from a custom site template


I am getting "A duplication content type name 'Approval' was found" error, when I try to create a new site based on a custom template.  These are the steps that result in the error:

  1. Create a new blank site.
  2. Without making any changes, save the blank site as a site template called "test".
  3. Try to create a new site based on the "test" template.
  4. Get the above error.

I did notice that when I tried creating site from the template in a different area of my site collection, the error name changed from "Approval" to "Requestor". 

As it stands I cannot use custom templates in my site collection.  Any advice on how to overcome this error?


Custom Theme for entire Site Collection

I created a theme with custom css for sharepoint 2010 Is it possible for me to use my custom CSS and have it be a selectable theme from each site without me having to modify the master pages of each site that wants to use the theme?

Creating a new root Site Collection using a custom site definition file (ONET.XML)

Using Powershell, I am trying to deploy the our custom solution to SP 2010.  The script is doing the following: Deleting the web application using Remove-SPWebApplication Creating a new web application using New-SPWebApplication Adding and deploying a series of WSP files (one of which has the site definition file in it) using Add-SPSolution and Install-SPSolution Create a root site collection based on the site definition file provided in the WSPs using New-SPSite I get the error "WARNING: Template is not found and is not applied." When I run Get-SPWebTemplate, my site definition does not show up. I saw this: http://social.msdn.microsoft.com/Forums/en/sharepoint2010general/thread/5ea46e07-a4b0-4bab-b698-9b6eeb695607 but I want a solution that does not involve me reloading a DLL, as, I feel there is something else I am forgetting. I have also tried: IISReset Resetting the timer service Cleaning the Cache (as described here: http://support.microsoft.com/kb/939308) Nothing seems to work.  Does anyone have any ideas?

cannot create a site collection

hi all, When I was creating a site collection in a new created web application, after clicking 'OK', it skipped to a page with error information which is: Error The URL 'Reporting Templates/audit.xlsx' is invalid.  It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web.   Troubleshoot issues with Microsoft SharePoint Foundation. Correlation ID: 55bd00e8-3ecd-41bc-b534-e59fbebfc2b7 Date and Time: 8/31/2010 3:20:38 PM I never met this before, what's wrong with my farm?

Unable to create columns in document library after applying custom master page to site

Hi, I have applied a custom master page to a site.There is a document library in it. I am unable to add columns in it or change the default view.Nothing happens when I click on OK butoon after making my changes. However the columns are created/default view is changed when I apply the default master page. Guess I am missing some TagPrefix or sharepoint control on master page.I had solved this problem earlier in this way but don't remeber it now. Can anyone help?

sp2010 - move site template ( or site ) from one site collection to another ?

Is it possible to save a site as a template in site collection A and move it to site collection B ? Can this be done using out of the box functionality through the browser or do I need to use powershell or some other tool ? please advise. thanks and regards, Counie  

Error when creating site collection through programmatically?

hi all, When i am creating SharePoint Site collection through programmatically i am getting an error message. i am using below code...   using (SPSite site = new SPSite("http://servername:7853/")) {   using (SPWeb web = site.OpenWeb()) {   SPWebApplication oweb = web.Site.WebApplication; site.AllowUnsafeUpdates = true;   SPSiteCollection sitecol = oweb.Sites;   SPSite site1 = oweb.Sites.Add("sites/DemoSiteCol", "DemoSiteCol", "Welcome to the Client SiteCol",1033, "STS#0", "Domian\\user", "display name", "user@domian.com");//here i am getting the error message as "Object refernce not set to an instance of an Object". oweb.Update(); } Please tell me why i am getting the error message.... thanks in advance.....

which one is better site template or site collection template for creating site collection?

hi all, i want to create site collection by using custom template. So I created one site and i saved as a template and i want to use this site template to create site collection...can we use site template  or site collection template to create site collections? what is the difference between site template and site collection template? please advise me which one is better..... thanks in advance...
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend