.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

feature stapling done against site definition breaks when saving site as a template?

Posted By:      Posted Date: September 13, 2010    Points: 0   Category :SharePoint
Hi, we have a bunch of feature stapling done against some of our site definitions on a solution we are working on. This feature staple has a bunch of feature dependancies which all work in a variety of ways. One of these dependancies then uses a feature receiver class to do some post provisioning setting up of web part connections and the like. This all works very well when creating a new site from a site definition etc etc. The problem arises when a user opts to provision a site in this way, and then uses the 'save as template' function within sharepoint. (BTW this is WSS 3.0 / MOSS). The site template saves correctly, but now the feature receiver never runs. I'm assuming this is because the associated feature staple doesnt run either? I've looked around and seen some reference to feature stapling not working against templates. Is this true? 

View Complete Post

More Related Resource Links

Using List templates - saved template has no site definition id or feature id - does not appear in S

I have a Record Centre site in SharePoint Server 2010 and have created a number of record libraries. Due to a reorganisation, I need to split my main record library up into about 20 separate libraries, so decided to use the list template as a means to create the new libraries with the same content types, views and workflows.

Used one of my libraries with no content and did Library Settings - Save document library as template and gave a name. Seemed to save OK to the List template gallery.

When I go to Site Actions - More Options the new template does not appear

Have done a fair bit of searching and I think the problem is that the .stp does not seem to have any site definition id and no means to add one.

Have enabled the SharePoint Server Publishing feature at the site level, as suggested by another post, but still has not resolved the problem.

Would value any ideas or insight. Thanks

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? 

How to decide whne we should use site definition or site template?

What is the difference between site definition and site template and whne do use site definition and site template?

Receiving error when saving site as template: [InvalidOperationException: Error generating solution

I am getting the following error when saving a site as a template (just this specific site is having this issue - other sites in collection successfully save as template): [InvalidOperationException: Error generating solution files in temporary directory.] Microsoft.SharePoint.SPSolutionExporter.ExportWebAsSolution() +26053165 Microsoft.SharePoint.SPSolutionExporter.ExportWebToGallery(SPWeb web, String solutionFileName, String title, String description, ExportMode exportMode, Boolean includeContent, String workflowTemplateName, String destinationListUrl) +1778 Microsoft.SharePoint.SPSolutionExporter.ExportWebToGallery(SPWeb web, String solutionFileName, String title, String description, ExportMode exportMode, Boolean includeContent) +44 Microsoft.SharePoint.ApplicationPages.SaveAsTemplatePage.BtnSaveAsTemplate_Click(Object sender, EventArgs e) +331 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +115 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +140 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981 I'm thinking it may have something to do with permissions, but other sites can save as a template. Also, it does not specify

Running code after site definition site creation in a event receiver or feature receiver

Hi guys I've got a site definition which is pretty much based on STS.This is it's own sharepoint project. Let's call this project SiteDefProj. Next in another SharePoint project (same solution though). Let's call this CustomListProject. In this project I've got a feature which provisions a bunch of lists based on custom content types - this feature is a site scoped. Let's call this feature: CustomListInstances. I have added a feature receiver to this feature to execute some custom code on the lists themselves (under feature activated) In my ONET.XML (part of the SiteDefProj) I have CustomListInstances feature ID as part of my <sitefeatures>. When I do a create site I can actually step through the code and see it actually being executed but after the site is created the list instances are created but it's like the code never run or did anything. The weird part is that stepping through the code while creating a site collection using my SiteDefProj the code runs great with no errors. All lists are there and the code runs smooth. If I manually create a STS site and activate my feature everything works and the code does actually run and the effects are visible after the feature is created. Again I can actually step through it in debug. My suspicion is that there's some sort of a race condition in the CREATE SITE functionality where maybe the web or site collection hol

SharePoint how does it know to use a feature default.aspx deployed instead of site definition defaul

I have created a feature which deploys a custom default.aspx page. The deployed file goes to the template\features{featureName} directory. How does SharePoint know to use this default.aspx page instead of the one that is located in SiteTemplates{Site Def name} directory?dave

Saving site as an template, and, creating new site with the saved template.



What is the process to save site as an template and create new site collection using the saved template?



Creating a Site Column that Looks up an External List causes error when saving site as a template.


I'm not sure what the best practice is here, but I'm having a major issue trying to save sites as templates and I think I narrowed it down as to what the issue is.

When I try to save a site as a template, it creates the solution package, but it doesn't activate it.  When I try to activate it manually, I get the following error:

Feature definition with Id e9431ed5-27b1-4c33-9eeb-81b4ace9d372 failed validation, file 'test1ListInstances\ElementsFields.xml', line 481, character 231: The 'SystemInstance' attribute is not allowed.

I opened up the solution package and looked at the ElementsFields.xml file.  I traced the line to this:

<Field Type="BusinessData" DisplayName="Acme People Name" Required="FALSE" EnforceUniqueValues="FALSE" Group="Custom Columns" ID="{55b3bbba-a7e3-4698-9946-648a6b726e9e}" SourceID="{026904fd-f2d0-4e57-a239-c6da838458fa}" StaticName="Acme_x0020_People_x0020_Name" Name="Acme_x0020_People_x0020_Name" SystemInstance="ACME" EntityNamespace="http://????????:28241" EntityName="People" BdcField="FullName" Profile="" HasActions="True" SecondaryFieldBdcNames="0" RelatedF

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

Saving a Site as Template in SP 2010




How can we save a site as .WSP from web UI? I cannot see this option in "Site Actions" menu.

Can anyone please help?




Feature Stapling + on creation of a new site stapling is not effecting + means The resource cannot b



i am working on feature stapling. pls find the code below:

http://www.beckybertram.com/oldblog/index.php?p=33&more=1&c=1&tb=1&pb=1  (i had written the code from this site).

after delpoyment of this solution.

problem: while i am creating a site - it is throwing " The resource cannot be found" error.

on log - file not found.

Very 1st site collection is able to apply. but while i am creating newly (after processing , it is thorwing this issue).

pls help me to make this work, i need to complete this by EOD. pls help me.

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.



Create site template wsp + Feature Activation: Cannot create folder



I try to create a new site based with a site template previously saved in a wsp solution and I get the following error :

Feature Activation: Threw an exception, attempting to roll back. Feature 'OnBoarding29Modules' (ID: '8f57f818-8940-4c42-bc0d-2626c72a4553'). Exception: Microsoft.SharePoint.SPException: Cannot create folder "Workflows/OnBoardingNew/Lists/Discussion5/Attachments". ---> System.Runtime.InteropServices.COMException (0x81070203): <nativehr>0x81070203</nativehr><nativestack></nativestack>Cannot create folder "Workflows/OnBoardingNew/Lists/Discussion5/Attachments".  
 at Microsoft.SharePoint.Library.SPRequestInternalClass.EnableModuleFromXml(String bstrSetupDirectory, String bstrFeatureDirectory, String bstrUrl, String bstrXML, Boolean fForceUnghost, ISPEnableModuleCallback pModuleContext)  
 at Microsoft.SharePoint.Library.SPRequest.EnableModuleFromXml(String bstrSetupDirectory, String bstrFeatureDirectory, String bstrUrl, String bstrXML, Boolean fForceUnghost, ISPEnableModuleCallback pModuleContext)   -
 -- End of inner exception stack trace ---  
 at Microsoft.SharePoint.Administrati

Anonymous Access in site template or feature activated by the site template, is it possible?



I'm building a custom site template and my question is if it's possible to set the anonymous access level in the deployment action.

I tried to create an EventReceiver (FeatureActivated), but I doesn't change the anonymous access level at deploy time. If I deactivate and reativate the feature from the site it works, but I miss the point, because like this it's the same thing then going to Site Permission and change the permission from there.

I do not want to set Anonymous Access from the Site Administration every time.


Set default Page Layout using Feature Stapling in SharePoint Site



I need to create custom SharePoint Feature using Visual Studio to set Default Page Layout for the publishing pages created in publishing site/ sub-sites.

Can you please guide me steps to create the custom feature using Visual Studio and how to deploy the same in the site.


Abhijit Sil

Deployment problem - Saving your changes will customize a page from the site definition - what does




I have created a customized report viewer web part which is a subclass of Microsoft.ReportingServices.SharePoint.UI.WebParts.ReportViewerWebPart. This component works perfectly well when I use it to build web part pages but is causing problems when I try to deploy pages from one site to another. I have isolated the problem as follows:

1. Create a new web part page and add my control. Assign it a SSRS report and test - everything works!

2. Go into SharePoint designer and edit the web part page making any change - this includes adding and then removing a character so that the page is EXACTLY THE SAME as originally created through the SP site. Save the page and you will be prompted:

"Saving your changes will customize a page from the site definition. Are you sure you want to do this?"

Reply yes and re-open the page in the site and the web part now throws an error.

OK - so the page aspx code is exactly the same as it was originally so what does "Saving your changes will customize a page from the site definition" actually do and why does SPD think it needs to make this change?

I am hoping that if I understand this I will be able to work out how to fix my web part to deploy successfully!

Andrew Wiles - www.it-workplace.com - MDX made simple

Invalid Template error after deploying site definition to different environment



I have developed a custom site definition with some custom features and web parts.All Works fine in my development environment i.e site is being created with necessary features and lists. But when I copy the respective files and folders to Production environment and installed my custom features and also run the IISRESET command and click on Create button by selecting my site definition in template section, its giving "The template you have chosen is invalid or cannot be found" error. But a few days prior I have deployed a initial version of the same site definition with same features and every thing had worked fine. I am going crazy of this absurd behavior of SharePoint.its really annoying as it accepts the same definition a few days prior and gives unfriendly error afterwards. If anybody had solved this issue please share it to me to get out of this.


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