コード例 #1
0
        protected override void StampChangesOn(IConfigurable dataObject)
        {
            TaskLogger.LogEnter();
            Organization organization = (Organization)dataObject;

            this.mergedCollection = new MultiValuedProperty <OrganizationSummaryEntry>();
            foreach (OrganizationSummaryEntry organizationSummaryEntry in organization.OrganizationSummary)
            {
                if (organizationSummaryEntry.NumberOfFields >= 3 || OrganizationSummaryEntry.IsValidKeyForCurrentAndPreviousRelease(organizationSummaryEntry.Key))
                {
                    this.mergedCollection.Add(organizationSummaryEntry);
                }
            }
            this.microsoftExchangeRecipient = MailboxTaskHelper.FindMicrosoftExchangeRecipient(this.recipientSession, (IConfigurationSession)base.DataSession);
            if (this.microsoftExchangeRecipient != null)
            {
                organization.MicrosoftExchangeRecipientEmailAddresses            = this.microsoftExchangeRecipient.EmailAddresses;
                organization.MicrosoftExchangeRecipientReplyRecipient            = this.microsoftExchangeRecipient.ForwardingAddress;
                organization.MicrosoftExchangeRecipientEmailAddressPolicyEnabled = this.microsoftExchangeRecipient.EmailAddressPolicyEnabled;
                organization.MicrosoftExchangeRecipientPrimarySmtpAddress        = this.microsoftExchangeRecipient.PrimarySmtpAddress;
                organization.ResetChangeTracking();
            }
            if (base.Fields.IsModified("ExchangeNotificationRecipients"))
            {
                this.SetMultiValuedProperty <RecipientIdParameter, SmtpAddress>(this.ExchangeNotificationRecipients, organization.ExchangeNotificationRecipients, new SetOrganizationConfig.Resolver <RecipientIdParameter, SmtpAddress>(this.ResolveRecipients));
            }
            if (base.Fields.IsModified(OrganizationSchema.RemotePublicFolderMailboxes))
            {
                this.SetMultiValuedProperty <MailboxOrMailUserIdParameter, ADObjectId>(this.RemotePublicFolderMailboxes, organization.RemotePublicFolderMailboxes, new SetOrganizationConfig.Resolver <MailboxOrMailUserIdParameter, ADObjectId>(this.ResolveRemotePublicFolderMailboxes));
            }
            base.StampChangesOn(dataObject);
            TaskLogger.LogExit();
        }
コード例 #2
0
        protected override void InternalValidate()
        {
            TaskLogger.LogEnter();
            base.InternalValidate();
            this.recipient = MailboxTaskHelper.FindMicrosoftExchangeRecipient((IRecipientSession)base.DataSession, DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(this.DomainController, true, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(base.CurrentOrganizationId), 114, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\RecipientTasks\\MicrosoftExchangeRecipient\\RemoveMicrosoftExchangeRecipient.cs"));
            if (this.recipient == null)
            {
                base.WriteError(new InvalidOperationException(Strings.ErrorMicrosoftExchangeRecipientNotFound), ErrorCategory.InvalidOperation, null);
            }
            IVersionable versionable = this.recipient;

            if (versionable != null && versionable.MaximumSupportedExchangeObjectVersion.IsOlderThan(versionable.ExchangeVersion))
            {
                base.WriteError(new TaskException(Strings.ErrorRemoveNewerObject(this.recipient.Identity.ToString(), versionable.ExchangeVersion.ExchangeBuild.ToString())), ErrorCategory.InvalidArgument, null);
            }
            TaskLogger.LogExit();
        }
コード例 #3
0
        protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            this.existingObject = MailboxTaskHelper.FindMicrosoftExchangeRecipient((IRecipientSession)base.DataSession, this.ConfigurationSession);
            ADMicrosoftExchangeRecipient admicrosoftExchangeRecipient;

            if (this.existingObject != null)
            {
                this.WriteWarning(Strings.MicrosoftExchangeRecipientExists);
                admicrosoftExchangeRecipient = this.existingObject;
            }
            else
            {
                admicrosoftExchangeRecipient = (ADMicrosoftExchangeRecipient)base.PrepareDataObject();
            }
            admicrosoftExchangeRecipient.DisplayName = ADMicrosoftExchangeRecipient.DefaultDisplayName;
            if (!base.IsProvisioningLayerAvailable && this.DataObject.OrganizationId.OrganizationalUnit != null)
            {
                base.WriteError(new InvalidOperationException(Strings.ErrorNoProvisioningHandlerAvailable), ErrorCategory.InvalidOperation, null);
            }
            TaskLogger.LogExit();
            return(admicrosoftExchangeRecipient);
        }
コード例 #4
0
        protected override void WriteResult(IConfigurable dataObject)
        {
            TaskLogger.LogEnter(new object[]
            {
                dataObject.Identity,
                dataObject
            });
            ADOrganizationConfig adorganizationConfig = dataObject as ADOrganizationConfig;

            if (adorganizationConfig != null)
            {
                int?num = this.RetrieveSCLJunkThreshold(adorganizationConfig.Id);
                if (num != null)
                {
                    adorganizationConfig.SCLJunkThreshold = num.Value;
                }
                this.FillTaskPopulatedFields(adorganizationConfig);
                MultiValuedProperty <OrganizationSummaryEntry> multiValuedProperty = new MultiValuedProperty <OrganizationSummaryEntry>();
                foreach (OrganizationSummaryEntry organizationSummaryEntry in adorganizationConfig.OrganizationSummary)
                {
                    if (OrganizationSummaryEntry.IsValidKeyForCurrentRelease(organizationSummaryEntry.Key))
                    {
                        multiValuedProperty.Add(organizationSummaryEntry.Clone());
                    }
                }
                multiValuedProperty.ResetChangeTracking();
                adorganizationConfig.OrganizationSummary = multiValuedProperty;
                adorganizationConfig.ResetChangeTracking();
            }
            ADSessionSettings sessionSettings;

            if (this.AccountPartition == null)
            {
                sessionSettings = ADSessionSettings.RescopeToSubtree(base.OrgWideSessionSettings);
            }
            else
            {
                PartitionId partitionId = RecipientTaskHelper.ResolvePartitionId(this.AccountPartition, new Task.TaskErrorLoggingDelegate(base.WriteError));
                sessionSettings = ADSessionSettings.FromAccountPartitionRootOrgScopeSet(partitionId);
            }
            IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(base.DomainController, false, ConsistencyMode.PartiallyConsistent, sessionSettings, 109, "WriteResult", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\organization\\GetOrganization.cs");

            tenantOrRootOrgRecipientSession.UseConfigNC = true;
            ADMicrosoftExchangeRecipient admicrosoftExchangeRecipient = MailboxTaskHelper.FindMicrosoftExchangeRecipient(tenantOrRootOrgRecipientSession, (IConfigurationSession)base.DataSession);

            if (admicrosoftExchangeRecipient == null)
            {
                if (adorganizationConfig.SharedConfigurationInfo == null)
                {
                    if (!this.IsOnlyGatewayServerRoleExist())
                    {
                        this.WriteError(new InvalidOperationException(Strings.ErrorMicrosoftExchangeRecipientNotFound), ErrorCategory.ReadError, adorganizationConfig.Identity, false);
                    }
                    else
                    {
                        base.WriteVerbose(Strings.MicrosoftExchangeRecipientNotFoundOnGatewayServerRole);
                    }
                }
            }
            else
            {
                ValidationError[] array = admicrosoftExchangeRecipient.Validate();
                for (int i = 0; i < array.Length; i++)
                {
                    this.WriteWarning(array[i].Description);
                }
                adorganizationConfig.MicrosoftExchangeRecipientEmailAddresses            = admicrosoftExchangeRecipient.EmailAddresses;
                adorganizationConfig.MicrosoftExchangeRecipientReplyRecipient            = admicrosoftExchangeRecipient.ForwardingAddress;
                adorganizationConfig.MicrosoftExchangeRecipientEmailAddressPolicyEnabled = admicrosoftExchangeRecipient.EmailAddressPolicyEnabled;
                adorganizationConfig.MicrosoftExchangeRecipientPrimarySmtpAddress        = admicrosoftExchangeRecipient.PrimarySmtpAddress;
                adorganizationConfig.ResetChangeTracking();
            }
            bool flag = !OrganizationId.ForestWideOrgId.Equals(adorganizationConfig.OrganizationId);

            if (flag)
            {
                MultiValuedProperty <string> multiValuedProperty2 = this.AcceptedDomainNamesGetter(adorganizationConfig);
                if (multiValuedProperty2 != null)
                {
                    adorganizationConfig.AcceptedDomainNames = multiValuedProperty2;
                }
            }
            if (VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled)
            {
                adorganizationConfig.HierarchicalAddressBookRoot = this.GetHierarchicalAddressBookRootFromOU(adorganizationConfig.OrganizationId.OrganizationalUnit);
            }
            base.WriteResult(new OrganizationConfig(adorganizationConfig, flag));
            TaskLogger.LogExit();
        }