Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am working with Visual Studio 2008 with the WSPBuilder add-in, and WSS 3.0. When I create a Web Part feature and deploy it to my SharePoint site, it is available to every site collection in the web application. Is there a way to only deploy it to a single site collection?

share|improve this question
    
When you say available, you mean activable in the site parameter ? –  Steve B Jul 21 '11 at 14:36
    
Not sure. I mean that if I have three site collections in the same web application, when I open the Site Collection Feature page for any of the three, I see the feature is listed and can be activated. I only want it available in ONE site collection for activation. –  CigarDoug Jul 21 '11 at 14:46
2  
That's one of the reasons sandboxed solution of SP2010 is a good thing :) –  Steve B Jul 21 '11 at 14:48
add comment

2 Answers

up vote 2 down vote accepted

This isn't possible. If you only want to activate in one site collection, set it as hidden, and activate via stsadm.

share|improve this answer
    
I was afraid of that. –  CigarDoug Jul 21 '11 at 15:29
add comment

One of a former project I worked on, I use a custom site template to hide features to other site collections.

The idea is to follow these steps :

  • create a custom site template specific to your application. I often use to starts from the blank site definition to start from scratch (but it can depends on your requirements)
  • create all features related to your application, and mark all of them "hidden"
  • in the onet.xml file, auto-activate your features.

When the user create an instance of your site, your features will be activated automatically. Other site collections won't show at all these features (but the feature will still be activable from command line).

If you look at Microsoft Publishing site template, you will see that a lot of features are hidden, but activated via the site definition.

Some drawbacks however, with this method :

  • the site must have been created using the custom template
  • it requires a deep understanding of the site template creation (not the easiest par of SharePoint)
  • when you use custom site templates, you have to manually found all feature stappled to the OOB templates, and apply them in the onet.xml
share|improve this answer
    
If you do this method, the normal thing to do is to just copy the ONET from the template you want to replicate, saves you having to dig out the features for activating automatically. Also, this method will restrict the feature activation to a site collection, but restricts what template they use to be able to use the desired Feature. –  James Love Jul 21 '11 at 15:03
    
@James Love: duplicating the onet.xml won't include all features activated via a feature stappling. While it's true that the <SiteFeatures> and <WebFeatures> can be replicated, some Enterprise or Standard features defines a Feature stapple to OOB templates. These stapples have to be extracted and manually set in the custom template to make it an exact copy of the OOB site definition. –  Steve B Jul 21 '11 at 15:08
    
Ah, good point, they're stapled to the site def in which they're activated. –  James Love Jul 21 '11 at 15:22
    
Thanks for detailed answer. James was first to reply, you gave more details. –  CigarDoug Jul 21 '11 at 15:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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