Has anyone ever succeeded in searching for names in an Exchange GAL linked to an iOS device, using ABAddressBook framework, or otherwise?
I've managed to get all the names from the contacts stored on the device - that bit's easy - but it doesn't include names from the Exchange GAL.
I've also managed to get the ABSource for the GAL. It's type is: kABSourceTypeExchangeGAL = kABSourceTypeExchange | kABSourceTypeSearchableMask
This suggests the source is searchable, given that the kABSourceTypeSearchableMask
bit is set (kABSourceTypeSearchableMask = 0x01000000
), but how to search it is anyone's guess? The documentation is almost non-existent.
There are similar stackoverflow questions listed below, but none of them provides a solution for this.
- Using iOS Addressbook api to search exchange contacts
- ABAddressBook -- Search Exchange AddressBook Source?
- ABAddressBook ABSource and ABSourceType
ABAddressBookCopyArrayOfAllPeopleInSource(addressBook, sourceToSearch)
always returns an empty array for sources that include the type bit kABSourceTypeSearchableMask
, which suggests that you have to search by name, rather than return "all people" because the Global Address List could have thousands and thousands of people in it, so I wouldn't expect it to return them all.
Contacts app allows you to search by name and shows only those that match. As does Mail app when entering text in the "To:" text field.
I am fairly sure this is not allowed -- by Microsoft.. Based on this http://social.msdn.microsoft.com/Forums/en-US/85713cae-c969-4abd-836f-394c2ed815d9/finding-contacts-in-exchange-global-address-list-using-ews-managed-api?forum=exchangesvrdevelopment and a quick wireshark trace, it looks like GAL queries are really LDAP queries being run directly against the DC...
来源:https://stackoverflow.com/questions/17566267/ios-how-to-search-a-searchable-absource-with-absourcetype-kabsourcetypese