コード例 #1
0
 internal void ValidateMessageDeliveryRestrictionGroup(ADRecipient recipient, string recipientId, Task.ErrorLoggerDelegate writeError)
 {
     if (!ADRecipient.IsAllowedDeliveryRestrictionGroup(recipient.RecipientType))
     {
         writeError(new RecipientTaskException(Strings.ErrorGroupRecipientNeeded(recipientId)), ExchangeErrorCategory.Client, recipientId);
     }
 }
コード例 #2
0
 protected override void SupervisionListAction()
 {
     TaskLogger.LogEnter();
     if (this.RemoveAll)
     {
         this.DataObject[ADRecipientSchema.DLSupervisionList] = null;
         this.DataObject[ADRecipientSchema.InternalRecipientSupervisionList] = null;
         this.DataObject[ADRecipientSchema.OneOffSupervisionList]            = null;
     }
     else
     {
         ADRecipient adrecipient = null;
         SmtpAddress?smtpAddress = null;
         base.ResolveEntry(this.Entry, out adrecipient, out smtpAddress);
         if (adrecipient != null)
         {
             bool isGroup = ADRecipient.IsAllowedDeliveryRestrictionGroup(adrecipient.RecipientType);
             this.RemoveADRecipientSupervisionListEntry(isGroup, adrecipient);
         }
         else if (smtpAddress != null)
         {
             this.RemoveExternalRecipientSupervisionListEntry(smtpAddress.Value);
         }
         else
         {
             base.WriteError(new ArgumentNullException("adRecipientToRemove, externalAddressToRemove"), (ErrorCategory)1000, null);
         }
     }
     TaskLogger.LogExit();
 }
コード例 #3
0
        protected override void SupervisionListAction()
        {
            TaskLogger.LogEnter();
            ADObjectId configContainerId = null;

            this.CheckTagValidForRecipientOrg(out configContainerId);
            ADRecipient adrecipient = null;
            SmtpAddress?smtpAddress = null;

            base.ResolveEntry(this.Entry, out adrecipient, out smtpAddress);
            if (adrecipient != null)
            {
                bool isGroup = ADRecipient.IsAllowedDeliveryRestrictionGroup(adrecipient.RecipientType);
                this.AddADRecipientSupervisionListEntry(isGroup, adrecipient);
            }
            else if (smtpAddress != null)
            {
                this.AddExternalRecipientSupervisionListEntry(smtpAddress.Value, configContainerId);
            }
            else
            {
                base.WriteError(new ArgumentNullException("adRecipientToAdd, externalAddressToAdd"), (ErrorCategory)1000, null);
            }
            TaskLogger.LogExit();
        }
コード例 #4
0
        private void VerifyDistributionGroups(MultiValuedProperty <RecipientIdParameter> identities, string parameterName)
        {
            if (identities == null)
            {
                return;
            }
            ADRecipient          adrecipient = null;
            HashSet <ADObjectId> hashSet     = new HashSet <ADObjectId>();

            foreach (RecipientIdParameter recipientIdParameter in identities)
            {
                try
                {
                    adrecipient = (ADRecipient)base.GetDataObject <ADRecipient>(recipientIdParameter, base.TenantGlobalCatalogSession, this.DataObject.OrganizationId.OrganizationalUnit, new LocalizedString?(Strings.ErrorRecipientNotFound(recipientIdParameter.ToString())), new LocalizedString?(Strings.ErrorRecipientNotUnique(recipientIdParameter.ToString())));
                }
                catch (ManagementObjectNotFoundException exception)
                {
                    base.WriteError(exception, (ErrorCategory)1003, null);
                }
                OrganizationId organizationId  = this.DataObject.OrganizationId;
                OrganizationId organizationId2 = adrecipient.OrganizationId;
                if (!organizationId.Equals(organizationId2))
                {
                    base.WriteError(new SupervisionPolicyTaskException(Strings.RecipientNotFoundInOrganization(recipientIdParameter.ToString())), (ErrorCategory)1003, null);
                }
                if (!ADRecipient.IsAllowedDeliveryRestrictionGroup(adrecipient.RecipientType))
                {
                    base.WriteError(new SupervisionPolicyTaskException(Strings.SpecifiedRecipientNotDistributionGroup(recipientIdParameter.ToString())), (ErrorCategory)1003, null);
                }
                if (!hashSet.Add(adrecipient.Id))
                {
                    base.WriteError(new SupervisionPolicyTaskException(Strings.ErrorRecipientIdParamElementsNotUnique(parameterName, recipientIdParameter.ToString())), (ErrorCategory)1003, null);
                }
            }
        }
コード例 #5
0
        internal static MultiValuedProperty <ADRecipient> ResolveAndSeparateMessageDeliveryRestrictionRecipientIdentities(MultiValuedProperty <DeliveryRecipientIdParameter> identities, string parameterName, IRecipientSession recipientSession, DataAccessHelper.CategorizedGetDataObjectDelegate getDataObject, Task.ErrorLoggerDelegate writeError, out MultiValuedProperty <ADObjectId> resolvedGroups, out MultiValuedProperty <ADObjectId> resolvedIndividuals)
        {
            resolvedGroups      = null;
            resolvedIndividuals = null;
            MultiValuedProperty <ADRecipient> multiValuedProperty = new MultiValuedProperty <ADRecipient>();

            foreach (RecipientIdParameter recipientIdParameter in identities)
            {
                ADRecipient adrecipient = (ADRecipient)getDataObject(recipientIdParameter, recipientSession, null, null, new LocalizedString?(Strings.ErrorRecipientNotFound(recipientIdParameter.ToString())), new LocalizedString?(Strings.ErrorRecipientNotUnique(recipientIdParameter.ToString())), ExchangeErrorCategory.Client);
                multiValuedProperty.Add(adrecipient);
                if ((resolvedGroups != null && resolvedGroups.Contains(adrecipient.Id)) || (resolvedIndividuals != null && resolvedIndividuals.Contains(adrecipient.Id)))
                {
                    writeError(new RecipientTaskException(Strings.ErrorRecipientIdParamElementsNotUnique(parameterName, adrecipient.Id.ToString())), ExchangeErrorCategory.Client, recipientIdParameter);
                }
                bool flag  = ADRecipient.IsAllowedDeliveryRestrictionGroup(adrecipient.RecipientType);
                bool flag2 = ADRecipient.IsAllowedDeliveryRestrictionIndividual(adrecipient.RecipientType);
                if (!flag && !flag2)
                {
                    writeError(new RecipientTaskException(Strings.ErrorGroupOrIndividualRecipientNeeded(recipientIdParameter.ToString())), ExchangeErrorCategory.Client, recipientIdParameter);
                }
                if (flag)
                {
                    if (resolvedGroups == null)
                    {
                        resolvedGroups = new MultiValuedProperty <ADObjectId>();
                    }
                    resolvedGroups.Add(adrecipient.Id);
                }
                else
                {
                    if (resolvedIndividuals == null)
                    {
                        resolvedIndividuals = new MultiValuedProperty <ADObjectId>();
                    }
                    resolvedIndividuals.Add(adrecipient.Id);
                }
            }
            return(multiValuedProperty);
        }