コード例 #1
0
        internal IEnumerable <RecipientData> LookupRecipientsBatchAtIndex(EmailAddress[] emailAddressArray, int index, out int batchStartIndex)
        {
            int batchSize;

            RecipientQuery.CalculateBatchIndexAndSize(emailAddressArray, index, out batchStartIndex, out batchSize);
            return(this.LookupRecipientsBatch(emailAddressArray, batchStartIndex, batchSize));
        }
コード例 #2
0
 internal IList <RecipientData> Query(string recipientSmtpAddress, ADObjectId recipientAdObjectId)
 {
     if (!string.IsNullOrEmpty(recipientSmtpAddress) && SmtpAddress.IsValidSmtpAddress(recipientSmtpAddress))
     {
         RecipientQueryResults recipientQueryResults = base.Query(new EmailAddress[]
         {
             new EmailAddress(string.Empty, recipientSmtpAddress)
         });
         if (recipientQueryResults != null && recipientQueryResults.Count > 0 && recipientQueryResults[0].Exception == null && recipientQueryResults[0].ProviderError == null)
         {
             return(recipientQueryResults);
         }
     }
     if (recipientAdObjectId != null)
     {
         ADRecipient adrecipient = base.ADRecipientSession.Read(recipientAdObjectId);
         if (adrecipient != null)
         {
             EmailAddress emailAddress = RecipientQuery.CreateEmailAddressFromADRecipient(adrecipient);
             return(new RecipientData[]
             {
                 RecipientData.Create(emailAddress, adrecipient, UserPhotoRecipientQuery.RecipientProperties)
             });
         }
     }
     this.tracer.TraceDebug <string, ADObjectId>((long)this.GetHashCode(), "Target user not found in directory.  Search params were SMTP-address='{0}' OR ADObjectId='{1}'", recipientSmtpAddress, recipientAdObjectId);
     return(Array <RecipientData> .Empty);
 }
コード例 #3
0
        internal List <RecipientData> ExpandDistributionGroup(RecipientData recipientData, DateTime queryPrepareDeadline, out bool groupCapped)
        {
            List <RecipientData> list = new List <RecipientData>(Configuration.MaximumGroupMemberCount);

            groupCapped = false;
            int num = 0;
            Queue <RecipientData> queue   = new Queue <RecipientData>(Configuration.MaximumGroupMemberCount);
            HashSet <Guid>        hashSet = new HashSet <Guid>(Configuration.MaximumGroupMemberCount);

            queue.Enqueue(recipientData);
            hashSet.Add(recipientData.Guid);
            while (queue.Count > 0 && !groupCapped)
            {
                RecipientData recipientData2 = queue.Dequeue();
                QueryFilter   filter         = new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.MemberOfGroup, recipientData2.Id);
                ADPagedReader <ADRecipient> adpagedReader = base.ADRecipientSession.FindPaged(null, QueryScope.SubTree, filter, null, Configuration.MaximumGroupMemberCount);
                ExTraceGlobals.DistributionListHandlingTracer.TraceDebug <object, SmtpAddress, int>((long)this.GetHashCode(), "{0}: Expanding group {1}, which has {2} members.", TraceContext.Get(), recipientData.PrimarySmtpAddress, recipientData.DistributionGroupMembersCount);
                foreach (ADRecipient adrecipient in adpagedReader)
                {
                    if (DateTime.UtcNow > queryPrepareDeadline)
                    {
                        groupCapped = true;
                        break;
                    }
                    if (!hashSet.Contains(adrecipient.Guid))
                    {
                        hashSet.Add(adrecipient.Guid);
                        if (adrecipient is ADUser || adrecipient is ADContact)
                        {
                            if (list.Count >= Configuration.MaximumGroupMemberCount)
                            {
                                groupCapped = true;
                                break;
                            }
                            EmailAddress emailAddress = RecipientQuery.CreateEmailAddressFromADRecipient(adrecipient);
                            list.Add(RecipientData.Create(emailAddress, adrecipient, base.PropertyDefinitionArray));
                        }
                        else if (adrecipient is ADGroup)
                        {
                            EmailAddress emailAddress2      = RecipientQuery.CreateEmailAddressFromADRecipient(adrecipient);
                            ADGroup      configurableObject = (ADGroup)adrecipient;
                            queue.Enqueue(RecipientData.Create(emailAddress2, configurableObject, base.PropertyDefinitionArray));
                        }
                        else
                        {
                            ExTraceGlobals.DistributionListHandlingTracer.TraceDebug <object, ADRecipient>((long)this.GetHashCode(), "{0}: Group member {1} is not a ADUser, ADContact or ADGroup. This member is not being processed.", TraceContext.Get(), adrecipient);
                        }
                    }
                    else
                    {
                        ExTraceGlobals.DistributionListHandlingTracer.TraceDebug <object, ADRecipient>((long)this.GetHashCode(), "{0}: Group member {1} has been found to be a duplicate and not being processed.", TraceContext.Get(), adrecipient);
                        num++;
                    }
                }
            }
            return(list);
        }
コード例 #4
0
 internal RecipientQueryResults(RecipientQuery recipientQuery, EmailAddress[] emailAddressArray)
 {
     this.recipientQuery     = recipientQuery;
     this.emailAddressArray  = emailAddressArray;
     this.recipientDataArray = new RecipientData[emailAddressArray.Length];
 }