Example #1
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            AddressBookBase dataObject = base.DataObject;

            if (dataObject.CheckForAssociatedAddressBookPolicies() && !this.HandleRemoveWithAssociatedAddressBookPolicies())
            {
                return;
            }
            ADObjectId id = base.DataObject.Id;

            base.InternalProcessRecord();
            if (!base.HasErrors)
            {
                try
                {
                    ADSessionSettings sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(base.RootOrgContainerId, base.DataObject.OrganizationId, base.ExecutingUserOrganizationId, false);
                    IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(base.TenantGlobalCatalogSession.DomainController, true, ConsistencyMode.PartiallyConsistent, sessionSettings, 99, "InternalProcessRecord", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\AddressBook\\RemoveAddressBook.cs");
                    tenantOrRootOrgRecipientSession.UseGlobalCatalog = true;
                    UpdateAddressBookBase <AddressListIdParameter> .UpdateRecipients(base.DataObject, new ADObjectId[]
                    {
                        base.DataObject.Id
                    }, base.DomainController, tenantOrRootOrgRecipientSession, new Task.TaskWarningLoggingDelegate(this.WriteWarning), new WriteProgress(base.WriteProgress), this);
                }
                catch (DataSourceTransientException ex)
                {
                    TIdParameter identity = this.Identity;
                    this.WriteWarning(Strings.ErrorReadMatchingRecipients(identity.ToString(), base.DataObject.LdapRecipientFilter, ex.Message));
                    TaskLogger.Trace("Exception is raised while reading recipients: {0}", new object[]
                    {
                        ex.ToString()
                    });
                }
                catch (DataSourceOperationException ex2)
                {
                    TIdParameter identity2 = this.Identity;
                    this.WriteWarning(Strings.ErrorReadMatchingRecipients(identity2.ToString(), base.DataObject.LdapRecipientFilter, ex2.Message));
                    TaskLogger.Trace("Exception is raised while reading recipients matching filter: {0}", new object[]
                    {
                        ex2.ToString()
                    });
                }
            }
            TaskLogger.LogExit();
        }
Example #2
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     try
     {
         ADSessionSettings sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(base.RootOrgContainerId, this.DataObject.OrganizationId, base.ExecutingUserOrganizationId, false);
         IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(base.TenantGlobalCatalogSession.DomainController, true, ConsistencyMode.PartiallyConsistent, sessionSettings, 459, "InternalProcessRecord", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\AddressBook\\UpdateAddressBook.cs");
         tenantOrRootOrgRecipientSession.UseGlobalCatalog = true;
         UpdateAddressBookBase <TIdParameter> .UpdateRecipients(this.DataObject, base.DomainController, tenantOrRootOrgRecipientSession, new Task.TaskWarningLoggingDelegate(this.WriteWarning), new WriteProgress(base.WriteProgress), this);
     }
     catch (DataSourceTransientException ex)
     {
         TIdParameter identity = this.Identity;
         base.WriteError(new InvalidOperationException(Strings.ErrorReadMatchingRecipients(identity.ToString(), this.DataObject.LdapRecipientFilter, ex.Message), ex), ErrorCategory.InvalidOperation, this.DataObject.Id);
         TaskLogger.Trace("Exception is raised while reading recipients: {0}", new object[]
         {
             ex.ToString()
         });
     }
     catch (DataSourceOperationException ex2)
     {
         TIdParameter identity2 = this.Identity;
         base.WriteError(new InvalidOperationException(Strings.ErrorReadMatchingRecipients(identity2.ToString(), this.DataObject.LdapRecipientFilter, ex2.Message), ex2), ErrorCategory.InvalidOperation, this.DataObject.Id);
         TaskLogger.Trace("Exception is raised while reading recipients matching filter: {0}", new object[]
         {
             ex2.ToString()
         });
     }
     if (!this.DataObject.ExchangeVersion.IsOlderThan(ExchangeObjectVersion.Exchange2007))
     {
         this.DataObject[AddressBookBaseSchema.LastUpdatedRecipientFilter] = this.DataObject.RecipientFilter;
         this.DataObject[AddressBookBaseSchema.RecipientFilterApplied]     = true;
     }
     base.InternalProcessRecord();
     TaskLogger.LogExit();
 }
Example #3
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            if (this.Recursive)
            {
                IConfigurationSession configurationSession = (IConfigurationSession)base.DataSession;
                List <ADObjectId>     list = new List <ADObjectId>();
                try
                {
                    this.currentProcent = 0;
                    ADPagedReader <AddressBookBase> adpagedReader = configurationSession.FindPaged <AddressBookBase>(base.DataObject.Id, QueryScope.SubTree, new ComparisonFilter(ComparisonOperator.NotEqual, ADObjectSchema.Id, base.DataObject.Id), null, 0);
                    foreach (AddressBookBase addressBookBase in adpagedReader)
                    {
                        list.Add(addressBookBase.Id);
                        if (list.Count % ADGenericPagedReader <AddressBookBase> .DefaultPageSize == 0)
                        {
                            this.MoveToNextPercent();
                            base.WriteProgress(Strings.ProgressActivityRemovingAddressListTree(base.DataObject.Id.ToString()), Strings.ProgressStatusReadingAddressListTree(list.Count), this.currentProcent);
                        }
                    }
                    list.Add(base.DataObject.Id);
                    if (this.currentProcent != 0)
                    {
                        this.ReportDeleteTreeProgress(null);
                    }
                    configurationSession.DeleteTree(base.DataObject, new TreeDeleteNotFinishedHandler(this.ReportDeleteTreeProgress));
                }
                catch (DataSourceTransientException exception)
                {
                    base.WriteError(exception, ErrorCategory.WriteError, base.DataObject.Identity);
                    TaskLogger.LogExit();
                    return;
                }
                try
                {
                    UpdateAddressBookBase <AddressListIdParameter> .UpdateRecipients(base.DataObject, list.ToArray(), base.DomainController, base.TenantGlobalCatalogSession, new Task.TaskWarningLoggingDelegate(this.WriteWarning), new WriteProgress(base.WriteProgress), this);

                    goto IL_206;
                }
                catch (DataSourceTransientException ex)
                {
                    this.WriteWarning(Strings.ErrorReadMatchingRecipients(this.Identity.ToString(), base.DataObject.LdapRecipientFilter, ex.Message));
                    TaskLogger.Trace("Exception is raised while reading recipients: {0}", new object[]
                    {
                        ex.ToString()
                    });
                    goto IL_206;
                }
                catch (DataSourceOperationException ex2)
                {
                    this.WriteWarning(Strings.ErrorReadMatchingRecipients(this.Identity.ToString(), base.DataObject.LdapRecipientFilter, ex2.Message));
                    TaskLogger.Trace("Exception is raised while reading recipients matching filter: {0}", new object[]
                    {
                        ex2.ToString()
                    });
                    goto IL_206;
                }
            }
            base.InternalProcessRecord();
IL_206:
            TaskLogger.LogExit();
        }
Example #4
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            IConfigurationSession configurationSession = (IConfigurationSession)base.DataSession;
            OrganizationId        organizationId       = (this.Identity != null) ? this.DataObject.OrganizationId : base.CurrentOrganizationId;
            ADSessionSettings     sessionSettings      = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(base.RootOrgContainerId, organizationId, base.ExecutingUserOrganizationId, false);

            configurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(configurationSession.DomainController, false, ConsistencyMode.PartiallyConsistent, configurationSession.NetworkCredential, sessionSettings, 102, "InternalProcessRecord", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\organization\\EnableAddressListPaging.cs");
            ADObjectId descendantId;

            if (organizationId != OrganizationId.ForestWideOrgId)
            {
                descendantId = organizationId.ConfigurationUnit.GetDescendantId(SystemAddressList.RdnSystemAddressListContainerToOrganization);
            }
            else
            {
                descendantId = base.RootOrgContainerId.GetDescendantId(SystemAddressList.RdnSystemAddressListContainerToOrganization);
            }
            AddressBookBase addressBookBase = configurationSession.Read <AddressBookBase>(descendantId);

            if (null == addressBookBase)
            {
                addressBookBase = new AddressBookBase();
                addressBookBase.SetId(descendantId);
                addressBookBase.DisplayName    = SystemAddressList.RdnSystemAddressListContainerToOrganization.Name;
                addressBookBase.OrganizationId = organizationId;
                configurationSession.Save(addressBookBase);
            }
            Dictionary <string, bool> dictionary;

            this.CreateCannedSystemAddressLists(configurationSession, addressBookBase, out dictionary);
            IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(base.TenantGlobalCatalogSession.DomainController, true, ConsistencyMode.PartiallyConsistent, null, sessionSettings, 146, "InternalProcessRecord", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\organization\\EnableAddressListPaging.cs");

            AddressBookBase[] array = configurationSession.Find <AddressBookBase>(descendantId, QueryScope.SubTree, null, null, 0);
            foreach (AddressBookBase addressBookBase2 in array)
            {
                if (base.Stopping)
                {
                    return;
                }
                bool flag = false;
                dictionary.TryGetValue(addressBookBase2.Name, out flag);
                if (this.DoNotUpdateRecipients.IsPresent)
                {
                    if (flag)
                    {
                        this.WriteWarning(Strings.WarningMustRunEnableAddressListPagingWithForceSwitch(addressBookBase2.Name));
                    }
                }
                else if (this.ForceUpdateOfRecipients.IsPresent || flag)
                {
                    UpdateAddressBookBase <AddressListIdParameter> .UpdateRecipients(addressBookBase2, base.DomainController, tenantOrRootOrgRecipientSession, new Task.TaskWarningLoggingDelegate(this.WriteWarning), new WriteProgress(base.WriteProgress), this);
                }
            }
            Organization orgContainer = configurationSession.GetOrgContainer();

            if (!orgContainer.IsAddressListPagingEnabled)
            {
                orgContainer.IsAddressListPagingEnabled = true;
                base.WriteVerbose(TaskVerboseStringHelper.GetSaveObjectVerboseString(orgContainer, configurationSession, typeof(Organization)));
                configurationSession.Save(orgContainer);
            }
            TaskLogger.LogExit();
        }
Example #5
0
 internal static void UpdateRecipients(AddressBookBase abb, string domainController, IRecipientSession globalCatalogSession, Task.TaskWarningLoggingDelegate writeWarning, WriteProgress writeProgress, Cmdlet cmdlet)
 {
     UpdateAddressBookBase <TIdParameter> .UpdateRecipients(abb, null, domainController, globalCatalogSession, writeWarning, writeProgress, cmdlet);
 }