internal void ValidateMessageDeliveryRestrictionIndividual(ADRecipient recipient, string recipientId, Task.ErrorLoggerDelegate writeError) { if (!ADRecipient.IsAllowedDeliveryRestrictionIndividual(recipient.RecipientType)) { writeError(new RecipientTaskException(Strings.ErrorIndividualRecipientNeeded(recipientId)), ExchangeErrorCategory.Client, recipientId); } }
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); }