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 taken one List Email event receiver(Type is EmailReceived) and that event receiver attach with document library. when i am activate that feature got error. i have check on ULS Viewer. error look like :

Feature Activation: Threw an exception, attempting to roll back. Feature 'Email_Doclib_Email Receivers' (ID: '8bb3a20f-22b6-4d05-b451-5db1a2714063').
Exception: System.InvalidOperationException: Operation is not valid due to the current state of the object. at Microsoft.SharePoint.Administration.SPElementDefinitionCollection.ProvisionContentTypeAndEventReceiverBindings(SPFeaturePropertyCollection props, SPSite site, SPWeb web, Boolean fForce)
at Microsoft.SharePoint.Administration.SPElementDefinitionCollection.ProvisionElements(SPFeaturePropertyCollection props, SPWebApplication webapp, SPSite site, SPWeb web, Boolean fForce)
at Microsoft.SharePoint.SPFeature.ProvisionElements(SPElementDefinitionCollection elemdefcoll, SPFeaturePropertyCollection props, SPWebApplication webapp, SPSite site, SPWeb web, Boolean fForce)
at Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, Boolean fForce)

right now there is no code on this Event receiver.

here is my Element file of Receiver

 <Receivers ListTemplateId="101">
  <Receiver>
    <Name>IncomingEmailEmailReceived</Name>
    <Type>EmailReceived</Type>
    <Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
    <Class>Email_Doclib.IncomingEmail.IncomingEmail</Class>
    <SequenceNumber>10000</SequenceNumber>
  </Receiver>

share|improve this question
1  
Yes, in my case, it was renaming the namespace which caused the issue. I had updated only the class.cs and not the elements.xml. Did so and it worked like a charm! Thank you very much ali Sharepoint! –  user18038 Jul 3 '13 at 15:32

1 Answer 1

up vote 1 down vote accepted

try this:

goto task manager and find

vssphost4.exe

Now remove it (end process), also perform an iisreset to remove any w3wp.exe and try again, it should work then!

if it doesnt than its an issue with your elements.xml file. make sure all your tags are correct including your class tag(<Class> </Class>) that should be your namespace followed by the class name and also the assembley name should be correct otherwise it will not work ;).

hope it helps :)

share|improve this answer
    
Hi,i got hints from your second options.i am checking on my dll on assembly but dll not exist on assembly.i just drag and drop Dll to assembly now activated featured successfully. do you know when cause like this prob? –  jigs Jan 7 '13 at 11:09
    
You need to check your manifest file, if its done through wspbuilder it will do it for you, if you made it then you need to state that you want to add it to the assembly, check DeploymentTarget is set to GlobalAssemblyCache :) –  ali Sharepoint Jan 7 '13 at 11:24
    
but.i want to deployed wsp to specific web-application. so i have set Assembly Deployment Target = Web Application instead of GlobalAssemblyCache.may be create prb by this? –  jigs Jan 7 '13 at 11:26
    
Yes it is a problem as its copied to the virtual bin directory instead of the assembly ;) check this link out it will explain the two :) msdn.microsoft.com/en-us/library/ms468837.aspx –  ali Sharepoint Jan 7 '13 at 11:30
    
plesase check this out msdn.microsoft.com/en-us/library/ms442108.aspx see if your doing your assembly the same for the webapp. (scroll down to see code) –  ali Sharepoint Jan 7 '13 at 11:39

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.