Feature activation error: System.InvalidOperationException: Operation is not valid due to the current state of the object

sharepoint.stackexchange https://sharepoint.stackexchange.com//questions/55371

Question

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>

Was it helpful?

Solution

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 :)

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