Beispiel #1
0
        private static void GetNamesByAnrFromContacts(UserContext userContext, AnrManager.NameParsingResult parsingResult, AnrManager.Options options, List <RecipientAddress> addresses)
        {
            if (string.IsNullOrEmpty(parsingResult.Name))
            {
                return;
            }
            if (userContext.TryGetMyDefaultFolderId(DefaultFolderType.Contacts) == null)
            {
                return;
            }
            string ambiguousName = parsingResult.ParsedSuccessfully ? parsingResult.RoutingAddress : parsingResult.Name;

            using (ContactsFolder contactsFolder = ContactsFolder.Bind(userContext.MailboxSession, DefaultFolderType.Contacts))
            {
                if (contactsFolder.IsValidAmbiguousName(ambiguousName))
                {
                    PropertyDefinition[] array;
                    object[][]           results;
                    if (AnrManager.IsMobileNumberInput(parsingResult, options))
                    {
                        array   = AnrManager.AnrProperties.Get(AnrManager.AnrProperties.PropertiesType.ContactFindSomeone, options);
                        results = contactsFolder.FindNamesView(new Dictionary <PropertyDefinition, object>
                        {
                            {
                                ContactSchema.MobilePhone,
                                parsingResult.Name
                            }
                        }, AnrManager.nameLimit, null, array);
                    }
                    else if (options.ResolveAgainstAllContacts || options.IsDefaultRoutingType("MOBILE"))
                    {
                        array   = AnrManager.AnrProperties.Get(AnrManager.AnrProperties.PropertiesType.ContactFindSomeone, options);
                        results = contactsFolder.FindSomeoneView(ambiguousName, AnrManager.nameLimit, null, array);
                    }
                    else
                    {
                        array   = AnrManager.AnrProperties.Get(AnrManager.AnrProperties.PropertiesType.ContactAnr, options);
                        results = contactsFolder.ResolveAmbiguousNameView(ambiguousName, AnrManager.nameLimit, null, array);
                    }
                    AnrManager.AddContacts(userContext, options, array, results, addresses);
                }
            }
        }
Beispiel #2
0
 // Token: 0x06000371 RID: 881 RVA: 0x00014240 File Offset: 0x00012440
 private AnrManager.LookupState GetNamesByAnrFromContacts(string name, List <ResolvedRecipient> recipients)
 {
     if (this.mailboxSession.GetDefaultFolderId(DefaultFolderType.Contacts) == null)
     {
         return(AnrManager.LookupState.FoundNone);
     }
     AnrManager.LookupState result;
     using (ContactsFolder contactsFolder = ContactsFolder.Bind(this.mailboxSession, DefaultFolderType.Contacts))
     {
         if (!contactsFolder.IsValidAmbiguousName(name))
         {
             result = AnrManager.LookupState.FoundNone;
         }
         else
         {
             object[][] array             = contactsFolder.ResolveAmbiguousNameView(name, int.MaxValue, null, AnrManager.anrContactProperties);
             List <RecipientAddress> list = new List <RecipientAddress>();
             int num = 0;
             while (array != null && num < array.GetLength(0))
             {
                 object[]    array2      = array[num];
                 Participant participant = array2[1] as Participant;
                 if (participant != null)
                 {
                     string           displayName      = array2[0] as string;
                     VersionedId      versionedId      = (VersionedId)array2[2];
                     StoreObjectId    storeId          = (versionedId == null) ? null : versionedId.ObjectId;
                     RecipientAddress recipientAddress = this.ConstructStoreRecipientAddress(participant, displayName, storeId);
                     if (recipientAddress != null)
                     {
                         if (recipientAddress.RoutingType != null && string.Equals(recipientAddress.RoutingType, "MAPIPDL", StringComparison.OrdinalIgnoreCase))
                         {
                             list.Add(recipientAddress);
                         }
                         else
                         {
                             recipients.Add(new ResolvedRecipient(recipientAddress));
                         }
                     }
                 }
                 num++;
             }
             bool flag = recipients.Count + list.Count == 1;
             foreach (RecipientAddress address in list)
             {
                 this.ExpandPDL(address, recipients);
             }
             if (recipients.Count == 0)
             {
                 result = AnrManager.LookupState.FoundNone;
             }
             else if (flag)
             {
                 result = AnrManager.LookupState.FoundExact;
             }
             else
             {
                 result = AnrManager.LookupState.FoundMany;
             }
         }
     }
     return(result);
 }