コード例 #1
0
        private bool RemoveProxyOperation(SPUserCodeService service, string assembly, string operation)
        {
            var  proxyOp = new SPProxyOperationType(assembly, operation);
            bool removed = service.ProxyOperationTypes.Remove(proxyOp);

            return(removed);
        }
コード例 #2
0
        // 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
            }
        }
コード例 #3
0
        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();
            }
        }
コード例 #4
0
        // 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
            }
        }
        /// <summary>
        /// Register Contoso Solution Validator.
        /// </summary>
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            SPUserCodeService   sandboxService           = SPUserCodeService.Local;
            SPSolutionValidator contosoSolutionValidator = new SolutionValidator(sandboxService);

            sandboxService.SolutionValidators.Add(contosoSolutionValidator);
        }
        /// <summary>
        /// Remove Contoso Solution Validator.
        /// </summary>
        public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        {
            SPUserCodeService sandboxService = SPUserCodeService.Local;
            Guid contosoSolutionValidatorId  = typeof(SolutionValidator).GUID;

            sandboxService.SolutionValidators.Remove(contosoSolutionValidatorId);
        }
コード例 #7
0
        /// <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();
        }
コード例 #8
0
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            SPUserCodeService userCodeService = SPUserCodeService.Local;

            SPProxyOperationType vendorPayablesOperation =
                new SPProxyOperationType(
                    AccountsPayableProxyArgs.AssemblyName, AccountsPayableProxyArgs.TypeName);

            userCodeService.ProxyOperationTypes.Add(vendorPayablesOperation);
            userCodeService.Update();
        }
コード例 #9
0
 private void AddProxyOperation(SPUserCodeService service, string assembly, string operation)
 {
     try
     {
         var proxyOp = new SPProxyOperationType(assembly, operation);
         service.ProxyOperationTypes.Add(proxyOp);
     }
     catch (Exception ex)
     {
         SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(ex.Source, TraceSeverity.High, EventSeverity.Error), TraceSeverity.High, ex.Message, ex.Data);
         //ex.ToString();
     }
 }
コード例 #10
0
 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);
     }
 }
コード例 #11
0
        // 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);
            }
        }
コード例 #12
0
        /// <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();
        }
コード例 #13
0
        /// <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();
        }
コード例 #14
0
 public SPSolutionCatagolizer(SPUserCodeService userCodeService)
     : base(name,userCodeService)
 {
     base.Signature = 1337;
 }
コード例 #15
0
        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();
            }
        }
コード例 #16
0
 public SolutionValidator(SPUserCodeService userCodeService)
     : base(strValidatorName, userCodeService)
 {
     this.Signature = 1983;
 }
コード例 #17
0
 public SolutionValidatorClass(SPUserCodeService service)
         :base(validatorID, service)
 {
     this.Signature = 1;
 }
コード例 #18
0
        private void AddProxyOperation(SPUserCodeService service, string assembly, string operation)
        {
            var proxyOp = new SPProxyOperationType(assembly, operation);

            service.ProxyOperationTypes.Add(proxyOp);
        }
コード例 #19
0
 /// <summary>
 /// Initializes a new instance of the SolutionValidator class.
 /// </summary>
 /// <param name="sandboxService">Sandboxed service instance.</param>
 public SolutionValidator(SPUserCodeService sandboxService) :
     base("ContosoSandboxedSolutionValidator", sandboxService)
 {
     Signature = 10000;
 }
 //Two constructors
 public DemoSolutionValidator(SPUserCodeService userCodeService) : base(VALIDATOR_NAME, userCodeService)
 {
     //SharePoint uses this value to determine if the validator has changed
     //Alter it for every version.
     this.Signature = 1234;
 }