0

Office 365 Solutions upload then site event Receiver call & Feature activated, did not work Event Receiver..

Below Code And Error Image

Code For Site EventReceiver

public class Project_SiteEventReceiver : SPFeatureReceiver
{

    public override void FeatureActivated(SPFeatureReceiverProperties properties)
    {
    try
    {
        using (SPSite site = (properties.Feature.Parent as SPSite))
        {
            using (SPWeb web = site.RootWeb)
            {              
    site.RootWeb.Features.Add(new Guid("a2992ae0-0a71-4443-b334-8a961c131d35"),true,SPFeatureDefinitionScope.Site);
            }
        }
    }
    catch (Exception ex)
    {
        throw ex;
    }
 }

enter image description here

  • What is the scope of feature for which you have written the Feature Receiver? If its a web scoped feature, properties.Feature.Parent should give you SPWeb instance. – Vineet Desai Apr 7 '16 at 6:05
  • Not to be that guy, but sandboxed solutions containing code is depricated so you really should not be developing new functionality using sandbox (specifically not for the cloud) – Robert Lindgren Apr 7 '16 at 6:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.