// handle the event raised before a feature is deactivated. public override void FeatureDeactivating(SPFeatureReceiverProperties properties) { try { SPUserCodeService userCodeService = SPUserCodeService.Local; if (userCodeService != null) { SPProxyOperationType operation = null; foreach (SPProxyOperationType operationType in userCodeService.ProxyOperationTypes) { if (operationType.AssemblyName.Equals(new FullTrustProxyArgs().FullTrustProxyOpsAssemblyName, StringComparison.CurrentCultureIgnoreCase)) { operation = operationType; break; } } if (operation != null) { userCodeService.ProxyOperationTypes.Remove(operation); userCodeService.Update(); } } else { } } catch { // Exceptionhandling } }
// handle the event raised after a feature has been activated. public override void FeatureActivated(SPFeatureReceiverProperties properties) { try { SPUserCodeService userCodeService = SPUserCodeService.Local; if (userCodeService != null) { SPProxyOperationType operation = new SPProxyOperationType( new FullTrustProxyArgs().FullTrustProxyOpsAssemblyName, new FullTrustProxyArgs().FullTrustProxyOpsTypeName); userCodeService.ProxyOperationTypes.Add(operation); userCodeService.Update(); } else { } } catch { // Exceptionhandling } }
public override void FeatureDeactivating(SPFeatureReceiverProperties properties) { try { IServiceLocator serviceLocator = SharePointServiceLocator.GetCurrent(); IServiceLocatorConfig typeMappings = serviceLocator.GetInstance <IServiceLocatorConfig>(); typeMappings.Site = SPContext.Current.Site; typeMappings.RemoveTypeMappings <LicenseRepository>(); typeMappings.RemoveTypeMappings <PageLayoutRepository>(); typeMappings.RemoveTypeMappings <MasterPageRepository>(); } catch (Exception ex) { ex.ToString(); } try { SPUserCodeService userCodeService = SPUserCodeService.Local; RemoveProxyOperation(userCodeService, ContainsKeyDataArgs.OperationAssemblyName, ContainsKeyDataArgs.OperationTypeName); RemoveProxyOperation(userCodeService, ReadConfigArgs.OperationAssemblyName, ReadConfigArgs.OperationTypeName); RemoveProxyOperation(userCodeService, ProxyInstalledArgs.OperationAssemblyName, ProxyInstalledArgs.OperationTypeName); userCodeService.Update(); } catch (Exception ex) { ex.ToString(); } }
/// <summary> /// Removes the proxy operations from the farm for configuration proxies. /// </summary> /// <param name="properties">The properties provided on deactivation</param> public override void FeatureDeactivating(SPFeatureReceiverProperties properties) { SPUserCodeService userCodeService = SPUserCodeService.Local; RemoveProxyOperation(userCodeService, ContainsKeyDataArgs.OperationAssemblyName, ContainsKeyDataArgs.OperationTypeName); RemoveProxyOperation(userCodeService, ReadConfigArgs.OperationAssemblyName, ReadConfigArgs.OperationTypeName); RemoveProxyOperation(userCodeService, ProxyInstalledArgs.OperationAssemblyName, ProxyInstalledArgs.OperationTypeName); userCodeService.Update(); }
public override void FeatureActivated(SPFeatureReceiverProperties properties) { SPUserCodeService userCodeService = SPUserCodeService.Local; SPProxyOperationType vendorPayablesOperation = new SPProxyOperationType( AccountsPayableProxyArgs.AssemblyName, AccountsPayableProxyArgs.TypeName); userCodeService.ProxyOperationTypes.Add(vendorPayablesOperation); userCodeService.Update(); }
public override void FeatureDeactivating(SPFeatureReceiverProperties properties) { try{ SPUserCodeService userCodeService = SPUserCodeService.Local; if (userCodeService != null) { userCodeService.SolutionValidators.Remove(new Guid("481823F5-75A7-4EF8-8A4B-11C4D52D1014")); userCodeService.Update(); } } catch (Exception ex) { EventLog.WriteEntry("SolutionValidatorDemo", ex.Message + ":" + ex.StackTrace); } }
// Uncomment the method below to handle the event raised after a feature has been activated. public override void FeatureActivated(SPFeatureReceiverProperties properties) { try { SPUserCodeService userCodeService = SPUserCodeService.Local; if (userCodeService != null) { userCodeService.SolutionValidators.Add(new SolutionValidator(SPUserCodeService.Local)); userCodeService.Update(); } } catch (Exception ex) { EventLog.WriteEntry("SolutionValidatorDemo", ex.Message + ":" + ex.StackTrace); } }
/// <summary> /// Removes the proxy operations for logging and tracing from the farm. /// </summary> /// <param name="properties">The properties provided</param> public override void FeatureDeactivating(SPFeatureReceiverProperties properties) { SPUserCodeService userCodeService = SPUserCodeService.Local; SPProxyOperationType loggingOperation = new SPProxyOperationType( ProxyOperationTypes.LoggingProxyAssemblyName, ProxyOperationTypes.LoggingOpTypeName); userCodeService.ProxyOperationTypes.Remove(loggingOperation); SPProxyOperationType tracingOperation = new SPProxyOperationType( ProxyOperationTypes.LoggingProxyAssemblyName, ProxyOperationTypes.TracingOpTypeName); userCodeService.ProxyOperationTypes.Remove(tracingOperation); userCodeService.Update(); }
/// <summary> /// Registers the proxy operation for logging and tracing with the farm. /// </summary> /// <param name="properties">The properties provided to the feature receiver</param> public override void FeatureActivated(SPFeatureReceiverProperties properties) { SPUserCodeService userCodeService = SPUserCodeService.Local; SPProxyOperationType loggingOperation = new SPProxyOperationType( ProxyOperationTypes.LoggingProxyAssemblyName, ProxyOperationTypes.LoggingOpTypeName); userCodeService.ProxyOperationTypes.Add(loggingOperation); SPProxyOperationType tracingOperation = new SPProxyOperationType( ProxyOperationTypes.LoggingProxyAssemblyName, ProxyOperationTypes.TracingOpTypeName); userCodeService.ProxyOperationTypes.Add(tracingOperation); userCodeService.Update(); DiagnosticsService.Register(); }
public override void FeatureActivated(SPFeatureReceiverProperties properties) { try { IServiceLocator serviceLocator = SharePointServiceLocator.GetCurrent(); IServiceLocatorConfig typeMappings = serviceLocator.GetInstance <IServiceLocatorConfig>(); //SPSite site = properties.Feature.Parent as SPSite; SPWeb web = properties.Feature.Parent as SPWeb; typeMappings.Site = web.Site; typeMappings.RegisterTypeMapping <ILicenseRepository, LicenseRepository>(); typeMappings.RegisterTypeMapping <IPageLayoutRepository, PageLayoutRepository>(); typeMappings.RegisterTypeMapping <IMasterPageRepository, MasterPageRepository>(); typeMappings.RegisterTypeMapping <IKeywordRepository, KeywordRepository>(); web.Update(); } catch (Exception ex) { SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(ex.Source, TraceSeverity.High, EventSeverity.Error), TraceSeverity.High, ex.Message, ex.Data); //ex.ToString(); } try { SPWeb web = properties.Feature.Parent as SPWeb; if (web.WebTemplate.ToLower() == "websiteroot") { //Hemrika.SharePresence.WebSite.Modules.WebPageModule.WebPageModule, Hemrika.SharePresence.WebSite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=11e6604a27f32a11 CreateWorkItem(web, "Hemrika.SharePresence.WebSite.Modules.WebPageModule.WebPageModule", "Hemrika.SharePresence.WebSite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=11e6604a27f32a11"); //Hemrika.SharePresence.WebSite.Modules.LicenseModule.LicenseModule, Hemrika.SharePresence.WebSite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=11e6604a27f32a11 CreateWorkItem(web, "Hemrika.SharePresence.WebSite.Modules.LicenseModule.LicenseModule", "Hemrika.SharePresence.WebSite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=11e6604a27f32a11"); //Hemrika.SharePresence.WebSite.Modules.SemanticModule.SemanticModule, Hemrika.SharePresence.WebSite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=11e6604a27f32a11 CreateWorkItem(web, "Hemrika.SharePresence.WebSite.Modules.SemanticModule.SemanticModule", "Hemrika.SharePresence.WebSite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=11e6604a27f32a11"); } } catch (Exception ex) { SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(ex.Source, TraceSeverity.High, EventSeverity.Error), TraceSeverity.High, ex.Message, ex.Data); //ex.ToString(); } /* * IConfigManager configManager = serviceLocator.GetInstance<IConfigManager>(); * configManager.SetWeb(SPContext.Current.Site.RootWeb); * IPropertyBag bag = configManager.GetPropertyBag(ConfigLevel.CurrentSPSite); */ try { SPUserCodeService userCodeService = SPUserCodeService.Local; AddProxyOperation(userCodeService, ContainsKeyDataArgs.OperationAssemblyName, ContainsKeyDataArgs.OperationTypeName); AddProxyOperation(userCodeService, ReadConfigArgs.OperationAssemblyName, ReadConfigArgs.OperationTypeName); AddProxyOperation(userCodeService, ProxyInstalledArgs.OperationAssemblyName, ProxyInstalledArgs.OperationTypeName); userCodeService.Update(); } catch (Exception ex) { SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(ex.Source, TraceSeverity.High, EventSeverity.Error), TraceSeverity.High, ex.Message, ex.Data); //ex.ToString(); } }