0

I've created a new feature in a pre-existing project, closely modelled on features that are already within that solution. These features activate automatically when a new MySite is created, but the new one doesn't. It's correctly installed, correctly scoped (at sitecol level) and can be manually activated through PowerShell or in the UI, but it doesn't happen automatically when the MySite site collection is created.

Any thoughts at all would be most welcome - thanks.

2 Answers 2

1

you've mentioned the old features in your solution that are somehow activated automatically. This is mostly likely possible because of the so called Feature stapler. This feature stapler allows you to automatically activate custom features when a certain site template is created. You can try searching for "FeatureSiteTemplateAssociation" word withing all xml files of your solution. This xml file might looks like this:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

  <FeatureSiteTemplateAssociation Id="91a39059-e694-4c80-8341-e18db90c0c58"
                                 TemplateName="SPSPERS#2"/>

  <FeatureSiteTemplateAssociation Id="d666a9ef-5317-44cb-8bff-57ebda1435f7"
  TemplateName="SPSPERS#2"/>
</Elements>

As you will probably see, this file already contains one or more feature associations. You just need to add yet another one for the feature that needs to be activated. Here is a sample:

http://blogs.msdn.com/b/kunal_mukherjee/archive/2011/01/11/feature-stapling-in-sharepoint-2010.aspx

3
  • Hi Denis, thanks for your reply. However, as stated above, I have already added another entry for the new feature, yet for some reason it is not being activated with its fellows...
    – Vassal
    Aug 16, 2013 at 16:09
  • You don't even have to set ActivateOnDefault for your site col feature. I can only think of the wrong ID in your FeatureSiteTemplateAssociation tag... Aug 16, 2013 at 16:15
  • I've definitely re-checked that one several times! :)
    – Vassal
    Aug 16, 2013 at 16:27
0

Have you looked to see if the other features are defined in the Site Template and you may need to add this new feature to the site template? See Feature stapling here...

You could also look into the feature ActivateOnDefault however The ActivateOnDefault attribute does not apply to site collection (Site) or Web site (Web) scoped Features.

3
  • Hi BlueBird, thanks for the quick response - yes, all necessary features (including my new one) are defined here. Am I right in thinking that normally this would be sufficient...?
    – Vassal
    Aug 16, 2013 at 15:54
  • Does the feature have any dependencies that may not be activated?
    – BlueBird
    Aug 16, 2013 at 15:59
  • A good idea (and one that I had not considered), but no the feature has no dependencies. It's also listed last in the .package file - I'm led to believe that features are installed/activated in the order they're listed in .package?
    – Vassal
    Aug 16, 2013 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.