Exemplo n.º 1
0
        protected override void InternalBeginProcessing()
        {
            TaskLogger.LogEnter();
            if (base.Fields.IsModified(SyncMailContactSchema.CountryOrRegion) && (this.DataObject.IsModified(SyncMailContactSchema.C) || this.DataObject.IsModified(SyncMailContactSchema.Co) || this.DataObject.IsModified(SyncMailContactSchema.CountryCode)))
            {
                base.WriteError(new RecipientTaskException(Strings.ErrorConflictCountryOrRegion), ExchangeErrorCategory.Client, null);
            }
            if ((this.SmtpAndX500Addresses != null && this.SmtpAndX500Addresses.Count > 0) || (this.SipAddresses != null && this.SipAddresses.Count > 0))
            {
                this.DataObject.EmailAddresses = SyncTaskHelper.MergeAddresses(this.SmtpAndX500Addresses, this.SipAddresses);
            }
            base.InternalBeginProcessing();
            if (this.ValidationOrganization != null && !string.Equals(this.ValidationOrganization, base.CurrentOrganizationId.ToString(), StringComparison.OrdinalIgnoreCase))
            {
                base.ThrowTerminatingError(new ValidationOrgCurrentOrgNotMatchException(this.ValidationOrganization, base.CurrentOrganizationId.ToString()), ExchangeErrorCategory.Client, null);
            }
            if (base.Fields.IsModified("Manager"))
            {
                this.manager = MailboxTaskHelper.LookupManager(this.Manager, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADRecipient>), ExchangeErrorCategory.Client, base.TenantGlobalCatalogSession);
            }
            if (base.Fields.IsModified(ADRecipientSchema.GrantSendOnBehalfTo) && this.GrantSendOnBehalfTo != null && this.GrantSendOnBehalfTo.Length != 0)
            {
                this.grantSendOnBehalfTo = new MultiValuedProperty <ADRecipient>();
                foreach (RecipientIdParameter recipientIdParameter in this.GrantSendOnBehalfTo)
                {
                    ADRecipient item = (ADRecipient)base.GetDataObject <ADRecipient>(recipientIdParameter, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.ErrorRecipientNotFound(recipientIdParameter.ToString())), new LocalizedString?(Strings.ErrorRecipientNotUnique(recipientIdParameter.ToString())), ExchangeErrorCategory.Client);
                    this.grantSendOnBehalfTo.Add(item);
                }
            }
            if (!base.Fields.IsModified(ADRecipientSchema.BypassModerationFromSendersOrMembers))
            {
                if (base.Fields.IsModified(MailEnabledRecipientSchema.BypassModerationFrom) && this.BypassModerationFrom != null)
                {
                    MultiValuedProperty <ADObjectId> multiValuedProperty;
                    MultiValuedProperty <ADObjectId> multiValuedProperty2;
                    this.bypassModerationFromRecipient = SetMailEnabledRecipientObjectTask <MailContactIdParameter, SyncMailContact, ADContact> .ResolveAndSeparateMessageDeliveryRestrictionRecipientIdentities(this.BypassModerationFrom, "BypassModerationFrom", base.TenantGlobalCatalogSession, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADRecipient>), new Task.ErrorLoggerDelegate(base.WriteError), out multiValuedProperty, out multiValuedProperty2);

                    if (multiValuedProperty != null && multiValuedProperty.Count > 0)
                    {
                        base.ThrowTerminatingError(new RecipientTaskException(Strings.ErrorIndividualRecipientNeeded(multiValuedProperty[0].ToString())), ExchangeErrorCategory.Client, null);
                    }
                    this.bypassModerationFrom = multiValuedProperty2;
                }
                if (base.Fields.IsModified(MailEnabledRecipientSchema.BypassModerationFromDLMembers) && this.BypassModerationFromDLMembers != null)
                {
                    MultiValuedProperty <ADObjectId> multiValuedProperty3;
                    MultiValuedProperty <ADObjectId> multiValuedProperty4;
                    this.bypassModerationFromDLMembersRecipient = SetMailEnabledRecipientObjectTask <MailContactIdParameter, SyncMailContact, ADContact> .ResolveAndSeparateMessageDeliveryRestrictionRecipientIdentities(this.BypassModerationFromDLMembers, "BypassModerationFromDLMembers", base.TenantGlobalCatalogSession, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADRecipient>), new Task.ErrorLoggerDelegate(base.WriteError), out multiValuedProperty3, out multiValuedProperty4);

                    if (multiValuedProperty4 != null && multiValuedProperty4.Count > 0)
                    {
                        base.ThrowTerminatingError(new RecipientTaskException(Strings.ErrorGroupRecipientNeeded(multiValuedProperty4[0].ToString())), ExchangeErrorCategory.Client, null);
                    }
                    this.bypassModerationFromDLMembers = multiValuedProperty3;
                }
            }
            if (base.Fields.IsModified(ADRecipientSchema.AcceptMessagesOnlyFrom) && this.AcceptMessagesOnlyFrom != null && this.AcceptMessagesOnlyFrom.Length != 0)
            {
                this.acceptMessagesOnlyFrom = new MultiValuedProperty <ADRecipient>();
                foreach (DeliveryRecipientIdParameter deliveryRecipientIdParameter in this.AcceptMessagesOnlyFrom)
                {
                    ADRecipient item2 = (ADRecipient)base.GetDataObject <ADRecipient>(deliveryRecipientIdParameter, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.ErrorRecipientNotFound(deliveryRecipientIdParameter.ToString())), new LocalizedString?(Strings.ErrorRecipientNotUnique(deliveryRecipientIdParameter.ToString())), ExchangeErrorCategory.Client);
                    this.acceptMessagesOnlyFrom.Add(item2);
                }
            }
            if (base.Fields.IsModified(ADRecipientSchema.AcceptMessagesOnlyFromDLMembers) && this.AcceptMessagesOnlyFromDLMembers != null && this.AcceptMessagesOnlyFromDLMembers.Length != 0)
            {
                this.acceptMessagesOnlyFromDLMembers = new MultiValuedProperty <ADRecipient>();
                foreach (DeliveryRecipientIdParameter deliveryRecipientIdParameter2 in this.AcceptMessagesOnlyFromDLMembers)
                {
                    ADRecipient item3 = (ADRecipient)base.GetDataObject <ADRecipient>(deliveryRecipientIdParameter2, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.ErrorRecipientNotFound(deliveryRecipientIdParameter2.ToString())), new LocalizedString?(Strings.ErrorRecipientNotUnique(deliveryRecipientIdParameter2.ToString())), ExchangeErrorCategory.Client);
                    this.acceptMessagesOnlyFromDLMembers.Add(item3);
                }
            }
            if (base.Fields.IsModified(ADRecipientSchema.RejectMessagesFrom) && this.RejectMessagesFrom != null && this.RejectMessagesFrom.Length != 0)
            {
                this.rejectMessagesFrom = new MultiValuedProperty <ADRecipient>();
                foreach (DeliveryRecipientIdParameter deliveryRecipientIdParameter3 in this.RejectMessagesFrom)
                {
                    ADRecipient item4 = (ADRecipient)base.GetDataObject <ADRecipient>(deliveryRecipientIdParameter3, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.ErrorRecipientNotFound(deliveryRecipientIdParameter3.ToString())), new LocalizedString?(Strings.ErrorRecipientNotUnique(deliveryRecipientIdParameter3.ToString())), ExchangeErrorCategory.Client);
                    this.rejectMessagesFrom.Add(item4);
                }
            }
            if (base.Fields.IsModified(ADRecipientSchema.RejectMessagesFromDLMembers) && this.RejectMessagesFromDLMembers != null && this.RejectMessagesFromDLMembers.Length != 0)
            {
                this.rejectMessagesFromDLMembers = new MultiValuedProperty <ADRecipient>();
                foreach (DeliveryRecipientIdParameter deliveryRecipientIdParameter4 in this.RejectMessagesFromDLMembers)
                {
                    ADRecipient item5 = (ADRecipient)base.GetDataObject <ADRecipient>(deliveryRecipientIdParameter4, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.ErrorRecipientNotFound(deliveryRecipientIdParameter4.ToString())), new LocalizedString?(Strings.ErrorRecipientNotUnique(deliveryRecipientIdParameter4.ToString())), ExchangeErrorCategory.Client);
                    this.rejectMessagesFromDLMembers.Add(item5);
                }
            }
            TaskLogger.LogExit();
        }