0

I need to deploy a list to sitecollections root web.

I have created projects before using feature stapling, etc that create list to root web of every site collection. However, now I need to create the list only at Root Site collections Root web. I have created a VS list instance. I have also set root web property to TRUE.

I need to know whether I need to set the scope of this feature to web or site collection and any other thing that I might have to keep in mind.

1

See if you want the list instance in only root site collection's root web than you will only ACTIVATE the feature in root site collection's root web..

Its all about activating the feature, you can keep the scope to web or site collection, what ever fits better..

If you don't want admins to activate feature in other site collections than you might need to write script on Feature Activated event to create a new list instance..

  • So you mean to say its the same effect if I set scope to WEB or to SITE. What matters is in which web I activate it... I want to know if we can tell the VS package to get activated only in root site coolection's root web? Or is powershell the only way ahead? – variable Apr 9 '14 at 7:24
  • If you set it to site collection level.. it will make sure the list is activated only on Root Web.. but it doesn't mean only on Root site collection's root web.. The activation of feature decides where the List is created.. Powershell or activating feature from UI will do.. – Arsalan Adam Khatri Apr 9 '14 at 7:27
  • You say that : "If you set it to site collection level.. it will make sure the list is activated only on Root Web." This statement holds only if ROOTWEB=TRUE, correct? – variable Apr 9 '14 at 7:29
  • Yes, ROOTWEB=TRUE will make sure of that.. – Arsalan Adam Khatri Apr 9 '14 at 7:31
  • 1 more question, not related, just asking. Suppose ROOTWEBONLY=FALSE; then on activating this feature at sitecollection level, will the list get deployed to rootweb and all the subsites(webs) of the sitecollection? – variable Apr 9 '14 at 7:37
0

If you are creating farm solution,the scope should be set to Site if you are creating the list declaratively,since you cannot add List instances to "WebApplication" scope feature. Now activate the feature only in root site collection of the web application. If you don't want this feature to be activated even accidently anywhere else, keep this feature hidden , and activate using powershell.

Another Approach: Or you can create a sandbox solution for creating lists declaratively, scope the feature to Site and upload this solution to only the Root sitecollection. This feature will be available only to that Site collection.(Only consider this if you have zero server side coding while creating lists)

  • No offense but the questioner never said he was going to scope the feature as Web Application.. – Arsalan Adam Khatri Apr 9 '14 at 7:32
  • @ArsalanAdamKhatri if he was creating lists through server object model, the best approach would be Create feature with "WebApplication" scope and write code in the feature activated. So i was just pointing out that since he is creating list declaratively, that option cannot be used – Unnie Apr 9 '14 at 7:34
  • So does that mean if I Scope to Site Collection or Web, I cannot create list using Object Model ? – Arsalan Adam Khatri Apr 9 '14 at 7:35
  • @ArsalanAdamKhatri in his requirement per web application the feature needs to be activated once.So always it will be better to make such feature scope as "WebApplication". But since in WebApplication scope features you cannot add VS List template , he has to scope the feature to "Site".This does not mean there is any restriction on the scope while creating lists using server object model, but there is while creating lists declaratively. – Unnie Apr 9 '14 at 7:38
  • No his requirement is not per web application.. but you are right.. – Arsalan Adam Khatri Apr 9 '14 at 7:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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