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

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

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

Posted By:      Posted Date: October 05, 2010    Points: 0   Category :SharePoint


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.

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..

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.....

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..

Activation of form template on site collection failed


I have checked and loaded an infopath form to Central Administration site. Then I try to activate the form template to my site collection and receive an error message. I found next in Log file

10/26/2010 09:37:49.54     w3wp.exe (0x14DC)                           0x11F0    InfoPath Forms Services           Administration                    82ep    Warning     Activation of form template on site collection http://site failed. (User: user,  Form Name: forma10, IP: , Request: http://site:2020/_admin/ActivateFormTemplate.aspx?templateId=a2caaaa0-e81f-4989-ac1e-5269e4dc28c7, Form ID: urn:schemas-microsoft-com:office:infopath:forma10:-myXSD-2009-06-02T06-46-10, Type: InfoPathLocalizedException, Exception Message: Activation could not be completed due to lack of funds to support InfoPath Forms Services.)    1e0da8dd-bd16-4c54-8abd-93ee888d6366

What can I do to fix that error?



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  

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......

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...

Activating Publishing Infrastructure at the Site Collection level


My task is to my company's branding solution to two new sites. I can upload the solution but I cannot activate it. I can't activate it because SharePoint Publishing is turned off on the sites. When I attempt to turn on SharePoint Publishing, I get this error:

The feature being activated is a Site scoped feature which has a dependency on a Site Collection scoped feature which has not been activated. Please activate the following feature before trying again: SharePoint Server Publishing Infrastructure f6924d36-2fa8-4f0b-b16d-06b7250180fa
The Site scoped feature being activated has a dependency on hidden Site scoped feature 'FeatureDefinition/22a9ef51-737b-4ff2-9346-694633fe4416' (ID: '22a9ef51-737b-4ff2-9346-694633fe4416'). Hidden features cannot be auto-activated across scopes. There may be one or more visible Site scoped features that auto-activate the dependent hidden feature.

I can't seem to locate the Publishing Infrastructure feature. The Site Collection List provides information about each site collection but no access to their features. How do I turn on Publishing Infrastructure?

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"

Publishing an Administrator Approved Form Programmatically


I'm hoping someone out there can help with this challenge?

I have a form that is being programmatically generated which I need to publish to SharePoint as, Administrator Approved. I need to use the form as a content type for the application we are developing which will live in SharePoint. 

I have no problem programmatically setting it to, "Full Trust" but I can't seem to find a way to programmatically publish the form as, "Administrator Approved". Don't worry about the bit in Central Admin with uploading the form template and activating it. I have that part working. Any help would be greatly appreciated!

Thanks for Your Help,


Site Collection Admin Unable to create subsite


Hi All,

We are running into a wierd kind of problem, we had a site called A, A had to be split for two different user base so A was exported into B. Now we have two sites A & B with its own user groups.

Site collection admins of B are not able to create subsites in B. But site collection Admins of both A & B are able to create subsites in either sites.

if site collection admin of  B is given read/write control on Site A then he is able to create sites in B (totally wierd)

Can anybody help me identifying what is happening here and points to start our troubleshooting.  

Thanks in Advance,



Activate Features on Site Collection creation via Site Template


I'm attempting to make my first Site Template, and I'm using some of the existing OOB template onet.xml files as a guide.  One thing I can't figure out is how to select which Features you want to be activated on the site collection creation from your template.

Also, how can you find a list of all available Features and the Scopes the are available for?

Programmatically activate SharePoint Server Enterprise Site Collection features


As my solution requires the enterprise features I'm required to activate them. Right now I'm doing it manually through "site settings -> site collection features", but I want to do it automatically when activating an other part of my solution. I've used PowerShell to see the difference for "Get-SPFeature -site myurl" before and after activating the enterprise feature by hand, but there're at least 10 site collection features being activated through this one click step.

Is there a list of features which are part of the SharePoint Server Enterprise Site Collection features or is there an easier way to activate them all at a time instead of doing it one by one programmatically.

Activating Publishing Feature for Team Site Template in SharePoint 2010


A new site collection has been created and uses SharePoint 2010 team site template. How can you activate the publishing feature on it?


I have activated the publishing feature at site collection and site level but I still can edit pages etc without requiring check out and approval/publishing. There are probably settings I need to activate on other doc libraries but I wanted to know the best practice for this scenario and how to configure it.



Programmatically syncing Active Directory changes with the SharePoint Site Collection


I manage a MOSS 2007 portal in Windows Server 2003, with a SQL Server 2005 backend.  We use Active Directory as the source for our SharePoint accounts.  I have written a Web Part that allows the user to edit certain fields in Active Directory, but the changes are not synched with the site collection right away.

I understand that the sync process is something like this:
1. Active Directory is updated.
2. SSP syncs with Active Directory (can force a sync from the web page, or with STSADM).
3. SSP syncs with underlying Site Collections (can force with STSADM).

This means that a user updates their information, but it is not apparent to them that the change went through, because the site collection profile is not updated. I know I can force a sync manually, but I want to do it programmatically.

What I want to do is this:  From my C# code in my Web Part, at the moment a user updates an Active Directory account, that account is synched with SSP, and then the SSP profile is updated in the site collection (I only have one site collection at the moment).  What is the code to accomplish this?




Christopher W. Douglas

activating news site template in sharepoint 2010


Hi friends,

I need to activate news site template in sharepoint 2010.

i have done this though command prompt. but its not activated. can u tell me complete procedure for activating this news site template

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