public void Delete(ObjectClass objClass, Uid uid, OperationOptions options)
        {
            const string operation = "Delete";

            plugins.OnBeforeDelete(objClass, uid, options, _configuration);

            ExchangeUtility.NullCheck(objClass, "objClass", this._configuration);
            ExchangeUtility.NullCheck(uid, "uid", this._configuration);

            LOG.Info("Exchange.Delete method; uid:\n{0}", uid.GetUidValue());

            DeleteOpContext context = new DeleteOpContext()
            {
                Connector = this,
                ConnectorConfiguration = _configuration,
                ObjectClass            = objClass,
                OperationName          = operation,
                Uid     = uid,
                Options = options
            };

            try {
                _scripting.ExecutePowerShell(context, Scripting.Position.BeforeMain);

                if (!_scripting.ExecutePowerShell(context, Scripting.Position.InsteadOfMain))
                {
                    DeleteMain(context);
                }

                _scripting.ExecutePowerShell(context, Scripting.Position.AfterMain);
            } catch (Exception e) {
                LOG.Error(e, "Exception while executing Delete operation: {0}");
                throw;
            }
        }
Exemple #2
0
        public void Delete(DeleteOpContext context)
        {
            ExchangeConnector        exconn = (ExchangeConnector)context.Connector;
            ActiveDirectoryConnector adconn = exconn.ActiveDirectoryConnector;

            adconn.Delete(context.ObjectClass, context.Uid, context.Options);
        }
        public void DeleteMain(DeleteOpContext context)
        {
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            GetHandler(context).Delete(context);

            LOG.Info("Exchange.Delete method exiting, took {0} ms", stopWatch.ElapsedMilliseconds);
        }
        public void DeleteMain(DeleteOpContext context)
        {
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            GetHandler(context).Delete(context);

            LOGGER_API.TraceEvent(TraceEventType.Information, CAT_DEFAULT,
                                  "Exchange.Delete method exiting, took {0} ms", stopWatch.ElapsedMilliseconds);
        }
        public void Delete(DeleteOpContext context)
        {
            ExchangeConnector exconn = (ExchangeConnector)context.Connector;

            Command cmdRemove = ExchangeUtility.GetCommand(
                new PSExchangeConnector.CommandInfo(GetRemoveCommandName()),
                context.Uid, exconn.Configuration);

            try {
                _helper.InvokePipeline(exconn, cmdRemove);
            } catch (ObjectNotFoundException e) {
                throw new UnknownUidException("Object with UID " + context.Uid.GetUidValue() + " couldn't be deleted", e);
            }
        }