Exemplo n.º 1
0
        private void GetExternalAddressEntries(ADRecipient dataObject, List <SupervisionListEntry> results)
        {
            MultiValuedProperty <ADObjectIdWithString> multiValuedProperty = (MultiValuedProperty <ADObjectIdWithString>)dataObject[ADRecipientSchema.OneOffSupervisionList];
            SupervisionRecipientType recipientType = SupervisionRecipientType.ExternalAddress;

            foreach (ADObjectIdWithString adobjectIdWithString in multiValuedProperty)
            {
                SupervisionListEntryConstraint supervisionListEntryConstraint = new SupervisionListEntryConstraint(true);
                if (supervisionListEntryConstraint.Validate(adobjectIdWithString, null, null) == null)
                {
                    string[] array = adobjectIdWithString.StringValue.Split(new char[]
                    {
                        SupervisionListEntryConstraint.Delimiter
                    });
                    SmtpAddress smtpAddress = new SmtpAddress(array[array.Length - 1]);
                    for (int i = 0; i < array.Length - 1; i++)
                    {
                        string text = array[i];
                        if (this.Tag == null || this.Tag.Equals(text, StringComparison.OrdinalIgnoreCase))
                        {
                            SupervisionListEntry item = new SupervisionListEntry(smtpAddress.ToString(), text, recipientType);
                            results.Add(item);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void GetADRecipientEntries(ADRecipient dataObject, bool isGroup, List <SupervisionListEntry> results)
        {
            MultiValuedProperty <ADObjectIdWithString> multiValuedProperty = isGroup ? ((MultiValuedProperty <ADObjectIdWithString>)dataObject[ADRecipientSchema.DLSupervisionList]) : ((MultiValuedProperty <ADObjectIdWithString>)dataObject[ADRecipientSchema.InternalRecipientSupervisionList]);
            SupervisionRecipientType recipientType = isGroup ? SupervisionRecipientType.DistributionGroup : SupervisionRecipientType.IndividualRecipient;

            ADObjectId[] array = new ADObjectId[multiValuedProperty.Count];
            for (int i = 0; i < multiValuedProperty.Count; i++)
            {
                array[i] = multiValuedProperty[i].ObjectIdValue;
            }
            Result <ADRawEntry>[] array2 = base.TenantGlobalCatalogSession.ReadMultiple(array, new PropertyDefinition[]
            {
                ADObjectSchema.RawName
            });
            for (int j = 0; j < multiValuedProperty.Count; j++)
            {
                ADObjectIdWithString           adobjectIdWithString           = multiValuedProperty[j];
                SupervisionListEntryConstraint supervisionListEntryConstraint = new SupervisionListEntryConstraint(false);
                if (supervisionListEntryConstraint.Validate(adobjectIdWithString, null, null) == null)
                {
                    string[] array3 = adobjectIdWithString.StringValue.Split(new char[]
                    {
                        SupervisionListEntryConstraint.Delimiter
                    });
                    string entryName = (string)array2[j].Data[ADObjectSchema.Name];
                    foreach (string text in array3)
                    {
                        if (this.Tag == null || this.Tag.Equals(text, StringComparison.OrdinalIgnoreCase))
                        {
                            SupervisionListEntry item = null;
                            try
                            {
                                item = new SupervisionListEntry(entryName, text, recipientType);
                            }
                            catch (ArgumentNullException exception)
                            {
                                base.WriteError(exception, (ErrorCategory)1000, null);
                            }
                            results.Add(item);
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        protected PropertyValidationError FindExternalAddressEntry(SmtpAddress externalAddress, MultiValuedProperty <ADObjectIdWithString> supervisionList, out ADObjectIdWithString foundEntry, out string[] tags)
        {
            if (supervisionList == null)
            {
                base.WriteError(new ArgumentNullException("supervisionList"), (ErrorCategory)1000, null);
            }
            foundEntry = null;
            tags       = null;
            SupervisionListEntryConstraint supervisionListEntryConstraint = new SupervisionListEntryConstraint(true);
            PropertyValidationError        propertyValidationError        = null;

            string[] array = null;
            foreach (ADObjectIdWithString adobjectIdWithString in supervisionList)
            {
                propertyValidationError = supervisionListEntryConstraint.Validate(adobjectIdWithString, null, null);
                if (propertyValidationError != null)
                {
                    return(propertyValidationError);
                }
                array = adobjectIdWithString.StringValue.Split(new char[]
                {
                    SupervisionListEntryConstraint.Delimiter
                });
                SmtpAddress smtpAddress = new SmtpAddress(array[array.Length - 1]);
                if (smtpAddress.Equals(externalAddress))
                {
                    foundEntry = adobjectIdWithString;
                    break;
                }
            }
            if (foundEntry != null)
            {
                Array.Resize <string>(ref array, array.Length - 1);
                tags = array;
            }
            return(propertyValidationError);
        }
Exemplo n.º 4
0
        protected PropertyValidationError FindADRecipientEntry(ADRecipient adRecipient, MultiValuedProperty <ADObjectIdWithString> supervisionList, out ADObjectIdWithString foundEntry, out string[] tags)
        {
            if (adRecipient == null)
            {
                base.WriteError(new ArgumentNullException("adRecipient"), (ErrorCategory)1000, null);
            }
            if (supervisionList == null)
            {
                base.WriteError(new ArgumentNullException("supervisionList"), (ErrorCategory)1000, null);
            }
            foundEntry = null;
            tags       = null;
            foreach (ADObjectIdWithString adobjectIdWithString in supervisionList)
            {
                if (adobjectIdWithString.ObjectIdValue.Equals(adRecipient.Id))
                {
                    foundEntry = adobjectIdWithString;
                    break;
                }
            }
            PropertyValidationError propertyValidationError = null;

            if (foundEntry != null)
            {
                SupervisionListEntryConstraint supervisionListEntryConstraint = new SupervisionListEntryConstraint(false);
                propertyValidationError = supervisionListEntryConstraint.Validate(foundEntry, null, null);
                if (propertyValidationError != null)
                {
                    return(propertyValidationError);
                }
                tags = foundEntry.StringValue.Split(new char[]
                {
                    SupervisionListEntryConstraint.Delimiter
                });
            }
            return(propertyValidationError);
        }