Question

I have created a custom list definition with my custom fields

Now I want to deploy my feature in farm level i.e

1 When I deploy my solution in central admin as a farm solution that particular list definition should be available for all the web applications and the site collections available and also for newly created ones.

2 I tried changing the scope of the default feature of list defintion to farm but I am encountering with a problem like "the list instance and list definition cannot be deployed at farm scope"

Note: I deployed the solution in web level and it works fine but for farm,site and webapp it throws me and error that it cannot deploy.

It is very important for me and please anyone help me with this... I would pleased if you can provide me the solution ASAP

Thanks in Advance

Was it helpful?

Solution

If I have understood your question, you have two problem:

  • activate your feature on all currently existing webs.
  • automagically activate the feature on every new web that will be created from this point onward.

For the first problem, you best bet would be using a PowerShell script to automate the activation process. For example:

Get-SPWebApplication “<WebApplicationURL>” | Get-SPSite -Limit ALL |
   ForEach-Object {Enable-SPFeature “MyFeatureID” -Url $_.Url -confirm:$false}’

This would activate a feature on all site collection in a web application. You could edit it to cycle on all web sites for each site collection for each web app.

You second problem requires that the feature gets activated by default on each new web site that you will create in the future. This can be resolved by using feature stapling. The feature stapling infrastructure enables you to attach a feature to an existing site/web definition so that when a new site/web is created the stappled feature will be activated. Note that this will work only for new sites (ie: the stapling is not retroactive). This link to another question should explain stapling in further detail.

Would a similar solution be viable for you?

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top