private static QueryFilter GetFilterForFindByEmailAddress(string prefix, ICollection <string> emailAddresses) { List <QueryFilter> list = new List <QueryFilter>(emailAddresses.Count); DirectoryPersonSearcher.AddFilterForEachEmailAddress(prefix, emailAddresses, list); if (list.Count == 0) { return(null); } if (list.Count == 1) { return(list[0]); } return(new OrFilter(list.ToArray())); }
private static QueryFilter GetFilterForFindByAddresses(ContactInfoForLinking contactInfo) { List <QueryFilter> list = new List <QueryFilter>(contactInfo.EmailAddresses.Count + 1); if (contactInfo.EmailAddresses.Count > 0) { DirectoryPersonSearcher.AddFilterForEachEmailAddress("smtp:", contactInfo.EmailAddresses, list); } if (!string.IsNullOrEmpty(contactInfo.IMAddress)) { list.Add(DirectoryPersonSearcher.GetFilterForFindByImAddress(contactInfo.IMAddress)); } if (list.Count == 0) { return(null); } if (list.Count == 1) { return(list[0]); } return(new OrFilter(list.ToArray())); }