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 using PowerShell script to deploy and activate a feature in the same script. Everything works fine and I can see my feature in the Sharepoint Root folder (14 hive).

I run it using Farm Admin.

My feature is Site Collection level and when I run the following line for root collection level.

Enable-SPFeature -Identity MyFeaure -Url http://br22:5646 

I get the following error:

Enable-SPFeature : The Feature is not a Farm Level Feature and is not found in a Site level defined by

Content of feature.xml :

<?xml version="1.0" encoding="utf-8"?> 
<Feature xmlns="schemas.microsoft.com/sharepoint/"; 
        Title="AUP Site Provisioning Feature" 
        Description="This feature will Create Custom List(s), Views and Share Point Groups for AUP Accelerator site" 
        Id="4e09be48-d2fc-49c6-9643-4f84aaa18806" 
        ReceiverAssembly="Tax.Accelerators.AUP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=73438e84b4622991"  
        ReceiverClass="Tax.Accelerators.AUP.AUP_Tax_FeatureEventReceiver" 
        Scope="Site"> 
    <ElementManifests> 
        <ElementManifest Location="ChangeStatusRibbonElement\Elements.xml" />
    </ElementManifests>
</Feature> 

What am I doing wrong?

share|improve this question
    
Should belong to SharePoint. –  Steve B Oct 25 '11 at 11:57
    
Can you paste your deployment script ? My bet is that you miss a call to install-spfeature. Also, do you use a wsp solution package ? –  Steve B Oct 25 '11 at 11:58
    
ya i use .wsp package and i follow Add-SPSolution,Install-SPSolution and then Enable-SPFeature statements. –  Jay Bhagatwala Oct 25 '11 at 12:01
    
can you paste the content of feature.xml ? Does Get-SPFeature -Url http://here returns your feature ? –  Steve B Oct 25 '11 at 12:03
    
<?xml version="1.0" encoding="utf-8"?> <Feature xmlns="schemas.microsoft.com/sharepoint/"; Title="AUP Site Provisioning Feature" Description="This feature will Create Custom List(s), Views and Share Point Groups for AUP Accelerator site" Id="4e09be48-d2fc-49c6-9643-4f84aaa18806" ReceiverAssembly="Tax.Accelerators.AUP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=73438e84b4622991" ReceiverClass="Tax.Accelerators.AUP.AUP_Tax_FeatureEventReceiver" Scope="Site"> <ElementManifests> <ElementManifest Location="ChangeStatusRibbonElement\Elements.xml" /></ElementManifests> </Feature> –  Jay Bhagatwala Oct 25 '11 at 12:12
show 3 more comments

migrated from stackoverflow.com Nov 7 '11 at 16:00

This question came from our site for professional and enthusiast programmers.

5 Answers

Jay,

Can you see this feature on Site Settings>> Site Collection Fetaures (OR Site Features). If not then you have to install using below command.

Have you install feature using this script ?

     Install-SPFeature -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\MyCustomFeature\feature.xml"

then run

Enable-SPFeature -Identity MyFeaure -Url http://br22:5646  
share|improve this answer
    
Yes , I can see that in Site Collection Feature list but not Activated mode.. –  Jay Bhagatwala Oct 25 '11 at 12:12
    
Can u activate manually ? –  SharePoint Build Oct 25 '11 at 12:16
    
ya i can activate manually, but only thing is that my feature contains 2 timer jobs, so if i activate manually it will be activated with other contnents but it will not allow me to create those timer jobs. I think thats whole logic behind running PS to deploy it.. –  Jay Bhagatwala Oct 25 '11 at 12:19
    
Try this Jay, Enable-SPFeature -Identity ChangeStatusRibbonElement -Url "siteurl" –  SharePoint Build Oct 25 '11 at 12:22
    
Jay bhai su thayu ... –  SharePoint Build Oct 25 '11 at 12:31
show 4 more comments

I had this when trying to activate the feature on the App server instead of the Web server on our farm.

share|improve this answer
add comment

write:

<?xml version="1.0" encoding="utf-8"?> 
<Feature xmlns="schemas.microsoft.com/sharepoint/"; 
        Title="AUP Site Provisioning Feature" 
        Description="This feature will Create Custom List(s), Views and Share Point Groups for AUP Accelerator site" 
        Id="4e09be48-d2fc-49c6-9643-4f84aaa18806" 
        ReceiverAssembly="Tax.Accelerators.AUP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=73438e84b4622991"  
        ReceiverClass="Tax.Accelerators.AUP.AUP_Tax_FeatureEventReceiver" 
        Scope="Site"> 
    <ElementManifests> 
        <ElementManifest Location="ChangeStatusRibbonElement\Elements.xml" />
        <ElementFile Location="Name of the file you want to copy on the site. "/>
    </ElementManifests>
</Feature> 
share|improve this answer
add comment

This error mostly occurs when you go wrong with the name of the feature. Activate it using GUID instead, should help!

share|improve this answer
    
Also, if the solution is not installed. Try running the command after Install-SPSolution has run completely... –  Suja Jan 26 '12 at 0:41
add comment

It's possible that when you ran Install-SPSolution you installed the solution to a specific web app which does not contain the site collection you are trying to activate the feature on.

For example if you installed the solution using the url http://yoursite and are now trying to activate the site on http://yoursite:9999 this will not work. You need to run the Install-SPSolution command with the url http://yoursite:9999

If this is all good to go then the problem lies with the Enable-SPFeature command. To use the name of the feature like you are, the "name" must actually be the name of the feature folder and not the name of the feature itself. You can navigate to the 14\Template\Features folder and see if you can find your feature. Use the name of the folder that your feature is located in. When using Visual Studio templates its defaulted to something like PROJECT_FeatureName instead of just FeatureName.

As another answer suggested, using the Guid instead is a pretty fail safe way of doing this as well. This can be found as the Id attribute of the Feature tag which in your case is 4e09be48-d2fc-49c6-9643-4f84aaa18806

share|improve this answer
add comment

Your Answer

 
discard

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