5

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>

1
  • 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
    Commented Jul 3, 2013 at 15:32

1 Answer 1

1

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

5
  • 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? Commented Jan 7, 2013 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 Jafer
    Commented Jan 7, 2013 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? Commented Jan 7, 2013 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 Jafer
    Commented Jan 7, 2013 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 Jafer
    Commented Jan 7, 2013 at 11:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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