.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

Creating a feature that will recreate a existing site with all it's subsite content

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

i have a site saye http://intranet

under that site i have http://intranet/eng


now i have to create a Feature that once activated will recreate the same site http://intranet and its subsites http://intranet/eng

http://intranet/IT with all its contents

in another site collection in the same FARM.

Any suggestions that will help me here 

View Complete Post

More Related Resource Links

Creating Site Collection in Existing Content Database

Hi All,

I'm trying to create a site collection in a existing content database. I haven't found a method in Sharepoint object model to perform such a action. There is an option to create a site collection in a new database using the following command:
SPSiteCollection.Add(url, siteDescription, siteDescription, 1033, siteTemplate,
                                                                siteCollPrimaryAdmin.LoginName, siteCollPrimaryAdmin.Name, siteCollPrimaryAdmin.Email,
                                                                siteCollSecondaryAdmin.LoginName, siteCollSecondaryAdmin.Name, siteCollSecondaryAdmin.Email,
                                                                strSQLServerName, siteContentDBName, null, null);

Is there a different object to do this creation on existing database? Any ideas to approach this problem will be greatly appreciated



content Type at site collection level using feature.

I m planning to create a feature to install the content type and site colomun at site collection level. Now my doubt is? 1. what will happen when i de activate a feature with documents already there? 2. what will happen when i de activate a feature without documents? What are points i need to take care? 

Feature with wsp for creating specific groups on any site creation

hi, i need to create a sharepoint feature for wss 3.0 with .wsp (wsp for easy deployment) which do folowing funtionality: Ability to run some custom code for creating specific custom groups on every site creation. Feature needs to be activated when deployed so when user create new site it creates groups based on our custom code( i have custom code for creating gorups just need to know how to attached it to feature which works on every site creation event) Any workable example is very helpful for me because i am very confuse and already did reasearch on that. i guess feature stapling is not the solution in my case. Thanks in advanced shaheen

Feature association in site definition( for site and subsite)



in Onet.xml

one configuration --Template  --is for Site collection site definition
second configuration --Template --is for subsite  site definition

when subsite is created with second configuration  receiver Feature
should be activated
I have associated feature  as

<!-- BascBrandGroup -->

FeatureSiteTemplateAssociation Id="AE6860A5-B140-47BB-8FF4-D971FB93D682"

Feature Id and template name is verified.
but feature is not getting activated.

Please suggest better approaches or if sample code for site collection
site def and ( site and subsite) def is available ,pls provide the link

Creating custom site template from a site that has a subsite - issue

  1. We created a Report Center site (a subsite) inside our site and then saved the site as a custom site template (including content). When we create the site out of this template, the site does not include the Report Center subsite. Can someone explain why?
  2. The report center was created for Key Performance Indicators (KPI) and we had published those KPIs on the parent site. We were hoping the any site created with our custom site template would show the KPIs. But we see only the KPI web part on the new site (created from our custom site template) without any KPI data. The reason is obvious because the data was coming from the Report Center subsite that does not get created by our custom site template. How do we accomplish this task via a custom site template?

Anything wrong with creating an Intranet/IIS web site as a subsite under Central Administration?

After installing WSS 3.0, we can set up a subsite under the Central Administration.  My question is: if we want to create an Intranet,
i.e. an IIS Web site/web application, is it okay to create this Intranet under the CentralAdministration?  It seemed to me it is not right
to create an Intranet under the Central Administration, but I don't know anything wrong.

Can we have "Content and structure" feature within My Site sites?

Hi everybody,

The "Site Settings > Site Administration > Content and structure" feature is quite usefull to move list / document library items preserving meta-data, history etc.

I did not found this feature within "My Site" parent site or subsites. It seems to be only available in "Collaboration Portal" site!

Is there a way to activate this feature for "My Site" sites?



Changing Feature Pack on an Existing Site


I'm seeing an issue where if I create a Sharepoint site and set it to a given site subscription and then go back to change the Feature Pack associated with the site subscription SharePoint 2010 does not reflect these new features in the UI. 


An example: 

I create a site with a feature pack that corresponds to the Foundation features.  At a later date I want to re-assign a new Feature Pack to the site subscription that corresponds to the Standard features. 

Doing the following to change the associated Feature Pack on the site subscription where $featurePackID is the GUID of the Feature Pack I want to change the subscription to using:


$sub = Get-SPSite -Identity $url

#Set Feature Pack
if ($featurePackID -ne "")

	$FeaturePack = Get-SPSiteSubscriptionFeaturePack $

Weird error when creating a site from a feature receiver


Hello everybody

I'm writing a feature in a sandboxed solution (scope of the feature : Web)

I've added to that feature a feature receiver that is supposed to create a subsite in the site in which it has been activated.

Here is the code

public override void FeatureActivated(SPFeatureReceiverProperties properties)
      string url="";
      using (SPWeb site = properties.Feature.Parent as SPWeb)
          site.Title = "root";
          SPWebTemplateCollection webTemplates = site.Site.RootWeb.GetAvailableWebTemplates(site.Language);
          url = site.IsRootWeb ? "subnews" : site.ServerRelativeUrl.Substring(1) + "/subnews";
          SPWebTemplate webTemplate = (from SPWebTemplate t
                         in webTemplates

Why do the aks master pages not get applied if the feature is not activated on the top site collecti


I installed AKS 2.0 and activated AKS feature. The problem I found was the aks master pages do not get applied if the feature is not activated on the top site collection. why is so?

example: If i activate the feature on http://<servername>/sites/<sitename> and apply the master page, I dont see any changes.

              But if i activate the same aks feature on http://<servername/ then everything started working on all sites.

              The reason i found is the CSS reference in the aks master pages.

              It reference should be given as follows:

                 for http://<servername>/sites/<sitename> ->  <link rel="stylesheet" type="text/css" href="../../Style%20Library/AKS/Aks_Band_Blueband.css"/>

                 for http://<servername>/ -><link rel="stylesheet" type="text/css" href="/Style%20Library/AKS/Aks_Band_Blueband.css"/>

So my question is, am i missing anything? am i supposed to activate the AKS feature on top level site collection at any cost? if yes, why is so? 

And after applying aks master pages, i see differnece in font sizes. Why the font size is getting changed?


Question on using variations on an existing site


I've been using MOSS 2007 for my company's CMS system for the last 2 years or so. Recently, the marketing department has asked us to include the option for multilingual support so naturally, I looked to using variations to accomplish this, however, the site was setup without variations since this was "definitely" not a requirement back when we setup the site.

My problem is when I enable variations, it seems to create new sites off of the root (e.g. English, Spanish, French), however,  it isn't copying anything from the Root site that already exists or any of it's subsites or pages. Is there any to keep my existing site content intact and still use variations, including all of the update features?

Thanks in advance

Is it. Is it really?

SharePoint 2007 - Consolidating everything as feature into WSP [Content Type, Page Layout, Pages, Ma


Hello –


Overview – We are building a Mobile Web Site using SharePoint 2007. The big screen site has been already built and we need to integrate the mobile site into same site collection of big screen –


·         The Mobile site will use the existing content types of existing big screen site

·         We will build a new custom Master page

Issue with List Definition of same base content type and deployed via same feature


I am trying to deploy two custom list definitions using only one single feature.  Below are the details of my issue.

  • Two custom list definitions
  • Each custom list definition has its own custom content type
  • Each custom content type inherits from the base content type Picture (Type = 109)
  • The custom list definitions are grouped together under one single feature
  • The custom content types are grouped together under a seperate single feature

When I deploy my solution in this configuration, the second list definition gets the first custom content type applied to it and the list schema from the first list definition is also applied to the second list definition.

What makes this more interesting, when I seperate both of the list definitions under two seperate features it all works fine.  Custom content types and list schemas get applied correctly.

Can anyone tell me why I can not deploy both list definitions under one single feature?

If you need me to post any of the origional code or XML to this post please let me know.



workflows when saving site as template with content

I have have a MOSS 2007 site on a production server with custom workflows.  I saved the site as a template with content and used the template to create a sibling site.  I am testing it and the workflows aren't working.  Is this to be expected? I have read that workflow don't work when saving between development and production, but I can't find anything that addresses both sites being on production. Will I need to recreate the custom workflows by hand? 

Why feature with event receiver doesn't activate properly after site provisioning?



I have defined feature with event receivers for my document library and for users List .

I try to activate my feature in onet.xml in section <WebFeatures>. After provisioning a new site from onet.xml  all work fine and my feature is shown as activated, but event receivers doesn't fire. It fires only after reactivating my feature (deactivate, then activate it again). But I need my feature works immediately after site provisioning without deactivating and activating it again. Who knows how to solve this problem?

part of ONET.xml



        <Feature ID="00BFEA71-4EA5-48D4-A4AD-7EA5C011ABE5"/>

        <!-- TeamCollab Feature -->

        <Feature ID="F41CC668-37E5-4743-B4A8-74D1DB3FD8A4"/>

        <!-- MobilityRedirect -->

        <!--My EventReceivers Feature-->

        <Feature ID ="41178843-A6A4-47c7-9EF9-B8A432E02B88"></Feature>





Creating SharePoint Server 2010 External Content Type Associations with SharePoint Designer 2010

Learn how to use Business Connectivity Services (BCS) to create associations between external content types in SharePoint Designer 2010 without using code.

Programmatically creating a SharePoint Site based on user input


I am working on developing a “Create Website Wizard” for SharePoint 2007 that would do the following (I am simplifying a little for the sake of this post):


1.      Take user input as follows:



Product Code:

Category (I, II, III):

The category will be a choice field (radio buttons or a dropdown)

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