.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

Turn on publishing programmatically when a subsite is created

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

I have a Site Collection with Publishing Site Template. I would like to have the publishing turned on automatically whenever a non-publishing subsite is created. Upon searching, I found there are two options. one with site definition and another with feature stapler.

I am new to .NET coding. Any code references to implement the above solution would be helpful.

View Complete Post

More Related Resource Links

UH-OH! i turned Simple Publishing On - How do i turn it Off?


I have recently deployed a site, where i turned Simple Publishing On in my sitedefinition.


The reason why i turned it On was to get rid of the approval workflow which my client did not need.


However it appear that not only the approval workflow was removed, but also the scheduling feature - therefore i will have to turn it Off again.


It will be easy for me to deploy a new sitedefinition, whith the SimplePublishing set to Off, but a lot of sites has allready been created using the "On" version.


I was thinking about making a small application that enumerated my Webs collection to accomplish that - but i cannot find what properties to use.


Does anybody know how to do this? Or even better - know if there is a way to make a simpler approval workflow?



moss 2007 for intranet ,publishing portal with collaboration portal subsite or other way.

Hi All, We are planning to use moss 2007 for our intranet. Mainly we want to use it for collaboration purpose (i think collaboration portal is the appropriate template as root site). but in future if the company want publishing portal can i have it under collaboration portal or should i choose now itself the root site as publishing portal  and then create collaboration portal as sub site to meet our needs. can some one shed light on how to proceed and pros/ cons . Cheers, Friend. 

How to start a workflow programmatically that was created in Sharepoint designer 2010?

Trying to start a workflow from code.  The workflow itself has been created in SPD 2010, which from what I understand, means that there is no assembly until the first time it's ran.  However, when I try to find the association record, that doesnt exist.  Is this becuase the 'code' hasnt been compiled yet?  If so, how can I have sharepoint start the just-in-time compiler for a declarative based workflow, so that can kick it off with in code? tia Rocky SandersRocky Sanders

How to read checkbox values from programmatically created checkboxes?


I have a form that does a loop to create checkboxes.  Here is the code in the loop:

cbxDrives.Top = TopPosition;
cbxDrives.Left = LeftPosition;
cbxDrives.Text = d.Name; 
CheckBox cbxDrives = new CheckBox();this.Controls.Add(cbxDrives);

This creates multiple check boxes on the form, and this works fine.

However, in the code behind for my button that the user clicks to execute the form, I cannot figure how how to read the values for the checkboxes.  I've tried:

foreach (CheckBox cbxDrive in cbxDrives)


Publishing subsite "Enable left navigation"



I have a team site with publishing site template as my Home page. I have created some subsites using  publishing site templates. In the sub-sites ,I am not able to see the left navigation, it gives me a page with contents but the left navigation pane is missing.

Any help will be appreciated.

Thx in Advance.

How to remove 'Delete Item' from context menu of a programmatically created list?

How to remove 'Delete Item' from context menu of a programmatically created list?
I have document library which is created programmatically but now I don't want to have 'Delete Item' in context menu of that document library. Are there any possibilites?

Setting Options Programmatically in Visio 2010 for Publishing to SharePoint Server 2010

Explore how to programmatically save Visio 2010 diagrams as web drawings for use with Visio Services in SharePoint Server 2010.

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,


Programmatically create publishing page and fill with content.


I have a bunch of HTML which has been exported from a different platform.
This HTML could be located in a database or contained within an HTML file. 

I am looking for some guidance on the best way to programmatically create a publishing page in SharePoint at a specific site location, then populating the RichHtmlField Publishing Web Control (PublishingPageContent) with the HTML that has been exported from one of the sources mentioned above.

Any suggestions/advice you can offer will be much appreciated.


Programmatically create blog subsite

public override void FeatureActivated(SPFeatureReceiverProperties properties)


   SPWeb web = (SPWeb)properties.Feature.Parent;



    web.Webs.Add("CommunityBlog", "Community Blog", "A blog for community sites", 1033, "BLOG#0", false, false);




    //write to logs




    //Free up resources




I have the code above in a feature receiver which is activated from my site definition. I don't receive any errors but when I create a new site collection based on my definition, no blog subsite is created. Is there a way to get the SPSite object without using SPContext, since it looks like it can't be used in a receiver?Any help would be appreciated.

Site Settings page empty-blank, Site Actions not clickable in custom site created programmatically f



We are migrating from MOSS 2007 to SharePoint 2010 and testing custom code used for creating sites. Sites were used to be created based on a site template, 'STP' file. In 2010, there are no more 'STP' files, instead 'WSP' solution packages are used, so we created a new WSP site template in Solutions gallery. The custom code uses that WSP for creating sites now.

But, when a site is created, and when you go to Site Settings from Site Actions menu, it load empty page - no any settings links or anything, just a blank page (/_layouts/settings.aspx). Also, Site Actions menu becomes unclickable.

Has anybody seen something like this?

Thanks a lot!


Regards, R.D.M.

Publishing subsite inside Team site


Hi All,

I have a publishing site as root site and I have 4 subsites under it with Team site template.

I would like to create a new subsite in one of the team site template subsites.

When I create a publishing site, the site was created with the publishing feature on but looks like it still retained the team site layout (with the left side quick launch navigation). Is it possible to create a actual publishing site under team site in this scenario?

Thanks in advance!




Publishing SQL Server Database using Publishing Wizard : Tips & Tricks

We can use SQL Server Publishing Wizard to deploy our local Database to remote hosting server/production server.This feature is available in SQL Server 2008/VWD 2008.

Below is the complete step by step guide of this process.

Export SharePoint List to Excel Spreadsheet Programmatically using C#

In SharePoint applications, Custom Lists are used to store business data and Document Libraries to store the documents. But for data manupulation and analysis, Microsoft Excel provides very rich features as compared to SharePoint Lists. That's why people still loves to work on Microsoft Excel Sheets.

Creating an Excel Spreadsheet programmatically using VB.NET

The Interoperability services make it very easy to work with COM Capable Applications such as Word and Excel. This article reveals using Excel from a managed application. Excel is the spreadsheet component of Microsoft Office 2000. The majority of Excel programmatic functionality is exposed through Automation via the type library Excel9.olb. The intention of this article is to express that a managed application can interrelate with Excel as a COM server.

Creating an Excel Spreadsheet and Adding Data to It Programmatically

The Interoperability services make it veryeasy to work with COM Capable Applications such as Word and Excel. Thisarticle reveals using Excel from a managed application. Excel is thespreadsheet component of Microsoft Office 2000. The majority of Excelprogrammatic functionality is exposed through Automation via the typelibrary Excel9.olb. The intention of this article is to express that amanaged application can interrelate with Excel as a COM server.

How to programmatically add controls to Windows forms at run time by using Visual C#

Create a Windows Forms Application
Start Visual Studio .NET or Visual Studio 2005 or a later version, and create a new Visual C# Windows Application project named WinControls. Form1 is added to the project by default.
Double-click Form1 to create and view the Form1_Load event procedure.
Add private instance variables to the Form1 class to work with common Windows controls. The Form1 class starts as follows:
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