コード例 #1
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
            }
        }
コード例 #2
0
        private static bool GetProxyInstalled(string assemblyName, string typeForProxy)
        {
            var  proxy      = new SPProxyOperationType(assemblyName, typeForProxy);
            bool proxyFound = SPUserCodeService.Local.ProxyOperationTypes.Contains(proxy, new ProxyComparer());

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

            return(removed);
        }
コード例 #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
            }
        }
コード例 #5
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();
        }
コード例 #6
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();
     }
 }
コード例 #7
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();
        }
コード例 #8
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();
        }
コード例 #9
0
        private void AddProxyOperation(SPUserCodeService service, string assembly, string operation)
        {
            var proxyOp = new SPProxyOperationType(assembly, operation);

            service.ProxyOperationTypes.Add(proxyOp);
        }