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 have just a small Question: Can I tell a feature with scope "Web" only to be activated on the RootWeb in Feature.Template.xml?

Something like

RootWebOnly="TRUE"

I have a listInstance (ConnectionLibrary) and a module with RootWebOnly="TRUE". Sure i can just change the scope to site and remove the RootWebOnly attribute, but i don't want to. I'm just curious if its possible to do that.

share|improve this question

3 Answers 3

up vote 2 down vote accepted

Set the scope to Scope="Site" and in the code make sure that whatever changes you make always point to SPContext.Current.Site.RootWeb(). If done correctly, it should only affect the rootweb as wanted.

share|improve this answer

I think it's impossible to do that, but it means that you want to do something on the site collection (the root web is the root of the site collection).

share|improve this answer

Logically, I am not sure if this is possible or not. May be we can restrict our code to SPContext.Current.Site.RootWeb() only but still..

share|improve this answer

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.