41

Feature stapling is a technique that allows for a feature to be stapled to a site definition by using a support "stapler" feature that defines which features are attached to which site definition. This allows for a feature to be automatically activated on a site created from a site definition without the need to modify the definition files (onet.xml). This ...


7

Is your production a multi server farm? I think you are facing the following issue: http://blogs.msdn.com/b/calvarro/archive/2011/11/06/sharepoint-2010-amp-visual-studio-2010-error-ocurred-activate-features-feature-with-id-installed-in-this-farm-cannot-be-added-to-this-scope.aspx It turns out that VS 2010 internally implements a call to the method ...


6

Don't think it is possible (anyone, fell free to correct me). But you can always do the opposite - staple a custom feature and deactivate the target features from the custom feature event receiver.


5

rjcup, Your client is likely not the right entity to ask what solution is best. If you're the developer, then you should know best and if your client doesn't trust your judgement, then your client has a problem much greater than how to get something done. If that client knows more about SharePoint than you do, then you have a quite different problem as well....


5

As each my "mysite" is a new site collection using a Microsoft Site Definition, there is no no-code solution for automatically adding web parts to a page. (Well there is one no-code solution: Someone could sit in central administration add refresh the list of "mysites" and when he sees a new one he could log in and add the web parts, but I think that after a ...


4

By design ListAdded can be hosted by SPWeb or SPSite only as documented here. So Feature Stapling cannot be avoided if you want to enforce that across the farm. UPDATE: As per MSDN Documentation, If the Receivers tag has no ListTemplateId or ListUrl attribute, the event receiver is registered at the same scope as the Feature. Which means you should not use ...


4

First of all, Start with a new feature to ensure everything is clean. Also, Please note that the configuration for Blank sites is configured(like below) to ignore any features stapled to the Global site definition.The same is true for some other site definitions as well. <Configuration AllowGlobalFeatureAssociations = "FALSE"...</Configuration> ...


4

Use GLOBAL as TemplateName. <?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <FeatureSiteTemplateAssociation Id="{464b78de-c14e-4c88-bd52-00136fc899f4}" TemplateName="GLOBAL" /> </Elements> See Feature/Site Template Association


3

If you're trying to associate your feature to the MySite, try this, substituting the GUID of the feature you want activated for the Id. This associates the specified feature to the SPSPERS#0 template (MySite). <?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <FeatureSiteTemplateAssociation ...


3

I recommend using a Web Event Receiver to do this, and handle the 'WebProvisioned' method. This can be created as a Site collection scoped feature that will trigger for every sub website that's provisioned.


3

The issue is the lists get created after the feature stapling is called in the Site Collection creation process. The My Site is a new Site Collection, not a new subsite, that's why the event receivers don't fire and the manual activation works. I have used a thread pool solution like the one in the link below to delay the execution until the lists have been ...


3

You should dispose of the SPWeb reference after each feature receiver has executed. public override void FeatureActivated(SPFeatureReceiverProperties properties) { using (SPWeb web = properties.Feature.Parent as SPWeb) { } } Admittedly, feature receivers such as this are one of the few places where you don't "have to" dispose of your SPWeb ...


3

Ok so in SharePoint 2010 there is a new player on the field: Custom Web Templates. I am now using them almost exclusively, instead of custom site definitions. Web Templates offer a few benefits over custom site definitions: Pros manifests can be upgraded (this is not supported on site defs!) can run within the sandbox and hence be used for SharePoint ...


3

Add these lines (inside the Elements tag) to an 'Empty Element' project item, then add that Project Item to a Feature (Scoped to Web Application, for example) in the solution.


3

Feature stappling simply means having a list of features to activate everytime a certain site definition is used (or in natural language stating "Do activate these features when any of the Site definition ID is created"). Basically there is always a Stappler (the actual feature linking one or more site definion ID with the actual features) and a Staplee (...


3

Technical Details Feature stapling is implemented through a Feature that is specifically designed to staple other Features to one or more site definitions. Feature stapling allows a Feature to be stapled to any new sites created from any site definition or from specific site definitions based on the template name identified in the appropriate WEBTEMP.xml ...


3

If I remember correctly the flow is: Site Collection Scoped Features Web Scoped Features Lists Modules Your stapled features would be shot in after Site collection scoped features or Web scoped features (depending on scope) and hence the lists is not guaranteed to be created before the lists. Found a source here: http://blogs.msdn.com/b/chrischiaro/...


3

We had the same problem. We had a stapling feature that was applying branding to my personal sites. Staplers code ran, but MDS was still active. What we did, was to add a custom control to a personal site master page which deactivated MDS when site was loaded. In this custom control we added if/else check if this code ran once ( by putting value to web....


3

Based on your comment, create a separate feature for page provisioning and add it in FeatureSiteTemplateAssociation after the lists are created and put the feature which adds XsltListViewWebPart third in the order. So by the time the code in feature activated event of third feature is called both Lists and Pages will be available.


3

I found the solution. Forgot to publish the content type and run the timer job (content type hub & subscriber). After that everything worked! I don't have to run the timerjobs in the feature (code), it works without it!


2

You can remove the feature reference in onet.xml


2

To elaborate some more about the stapling solution. As Microsof says for SharePoint 2007 (but the same is valid for the 2010 version) "Feature stapling is a concept that allows you to attach (or staple) a SharePoint Feature to a SharePoint site definition without modifying the original site definition files in any way". In that sense, stapling is a valid ...


2

I developed my own little framework (too big word) to achieve complete upgradability of my solutions. This was major issue for most of my clients. In short: I am feeding my framework on feature (de)activation with some very simplified CAML definitions and I have covered in code most of the commonly needed stuff (adding/upgrading lists, receivers, content ...


2

Depending on how you configured your staples you might want to consider attaching it to the Blog Site template too (most likely you attached it to SPSPERS#0). You would need to target the template BLOG#0 also. Simply add another line to your stapling feature as follows <FeatureSiteTemplateAssociation Id="<GUID OF FEATURE HERE>" TemplateName="BLOG#...


2

There is n o restriction as such that both the features should be in same project. It is always good practice to keep a separate project for site columns/content types/List & Libraries.Below are the points to be kept in mind while creating feature stapling: Staplee feature should be having higher scope than stapled feature. eg: if stapled feature is ...


2

Can you apply your theme via the UI? Is your feature activated/deployed on your blog? The .master needs to be in the blog web in under _catalogs/masterpage. Also make sure you configured your FeatureStapling correct - Blog is not the same site template as the other sites. Here's a example: <?xml version="1.0" encoding="utf-8"?> <Elements ...


2

By looking into your code, i think the problem is item.Delete(); item.Update(); You are updating item after you are deleting, there is no need to update the item after delete. You can not update a deleted item.


2

I also faced the same issue. Please make sure that the feature id that you have mentioned in feature stapler must be exactly same as feature id by which you are deploying your event receiver. Please check the below post "http://weblogs.asp.net/sreejukg/apply-custom-theme-to-sharepoint-2013-mysite-using-feature-stapling" Point to be noticed in the above ...


2

We had the same problem couple of months ago, after digging too much we open a MSFT case. Here how we solve it. After updating the wsp, we check if new dll deployed. We also check if updated DLL loaded Recycle the SharePoint timer services on all servers. We use the decompiler tool to find which assembly loaded. In our case, even after updating( many time ...


Only top voted, non community-wiki answers of a minimum length are eligible