I'm developing an app that has to retrieve all the contacts from the Address Book and display them according to the source (Gmail, iCloud, Outlook, Facebook ecc). I've already looked up all similar previous answer on this topic: has anybody found an answer?
Is it possible to discriminate between these sources (for example using mail addresses)?
Using kABSourceTypeProperty and kABSourceNameProperty seems not effective because two Gmail accounts will have same name and same type.
Furthermore is there a way to have a more significant name?
For now I have only names like this:
- name = "" (empty string) for Facebook contacts
- name = "Card" for iCloud contacts
- name = "Address Book" for Gmail contacts
- name = nil for Local Address Book, etc
If someone else is still stuck with this problem i found a trick solution for the sources of type kABSourceTypeCardDAV (such as Gmail and Yahoo accounts).
The trick is to access the kABPersonLastNameProperty of the ABRecordRef of the source even if it should be a ABPerson-only property. The result is a path (I think where the contacts are stored in the phone) that contains also the mail/name of the account.
Still no idea how to get the name of the account in the kABSourceTypeExchange case!
Related
I'm having a bit of a problem with trying to access the same contact between multiple devices. My goal is to have a user select a contact and select a phone number and email address, which will then be stored in a database. If the user opens the app on another device, I would like to have the same contact selected.
I was hoping to use the CNContact.identifier for this case, but it appears that it is a device specific id. I could store the identifier for each device, but that would require the user matching contacts and that doesn't seam ideal.
This doesn't seam like it should be difficult but apparently I'm missing something. Thoughts?
The solution that seams to working for me is, I store the Contact identifiers, Address identifiers, Contact name, and the Address in my database. Then I take a mutli-step appoarch.
Search for Contact:
I attempt to find the contact based on the stored contact.identifiers I have already saved.
If I find 1 contact (identifier matched) => Great! I then attempt to match the found contact to my address.identifiers. Once again, if I find only 1 match, we're great! If not I then go to attempt to find an address (See below)
If I find no contacts (no identifiers matched) => I attempt to find the contact based on the Contact Name I had saved previously. If I do find a match, I then go to attempt to find the matching address (see below).
Search for Address:
Since at this point, I have a CNContact record that I believe matches, I look at each of their postalAddresses and compare it against the Street/city/state/zipcode/country that I have stored in my database.
If we find that perfect match, then I update my identifiers to include the new address/contact identifiers
If we ultimately don't find a match, I give the user an option to manually select the contact/address from their device.
I have a list of users in Firebase that looks like this...
How would I retrieve only the email (for example) values?
THE answer.
Two things.
1) Please copy and paste your structure instead of a picture so we don't have to retype it. Please take a minute to format it so it looks cool.
2) This is a very basic query in Firebase and fully explained in the Most Excellent Guide to Retrieving Data In Firebase
Scroll down the query section and there are a couple of examples that are very similar to what you are asking for.
And a tad more info. Doing a query will retrieve each child node that matches the query (including the other stuff within the node). It's up to your code to grab each email (pretty simple task as it's key:value pairs)
If you don't want the other stuff, you would need to change the structure of the data
asdf
firstName
lastName
etc
emails
asdf
email: email address
asdf1
email: email address
or, use events: value for example and a structure like this
emails
asdf: email address
asdf1: email address
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...
When I query for customers I get back a customer object with all the info. one of the properties is the Address. this contains the billing and shipping addresses for the customer. however, the id field for each address is always null. I am wondering how I push an update back to QBO without the id? how does QBO know which address I am changing without a key of some kind? my goal is to be able to query QBO and get all the customers and address that have changed since a specified date. I have all this working for the customer but need to do the same for addresses. I am going by the assumption that when an address is changed in QBO that is sets the modified timestamp for that customer record. can anyone tell me how I manage the addresses for a customer and be able to push updates back to QBO?
Try using tag(Billing/Shipping) attribute while updating the address. I've tested the same and it is working fine.
You mentioned earlier that you were getting the id field of address as null. It is becuase, the devkit works with both - QBO and QBD. QBD returns valid element id but QBO doesn't. So for QBO, Devkit shows null in place of element id(in your case - address's id).
You can test all these using api explorer(http://developer.intuit.com/apiexplorer).
Hope it will solve your porb.
Thanks
'the id field for each address is always null' - this line is not very clear to me. Did you mean the id of the customer entity ? Plz explain.
You can check the QBO-Customer object's documentation and sample update request xml, from the following Link - https://ipp.developer.intuit.com/0010_Intuit_Partner_Platform/0050_Data_Services/0400_QuickBooks_Online/Customer .
For testing you can use the api-explorer. Link - developer.intuit.com/apiexplorer
Thanks
Manas
Why doesn't the related account show up from this URL?
http://twitter.com/intent/tweet?text=HeyNow&related=HowardStern&hashtags=bababooey
The result is this:
HeyNow #bababooey
But I expect it to be:
HeyNow #HowardStern #bababooey
Instead of the variable related you have to use the variable via. Try this:
https://twitter.com/intent/tweet?text=HeyNow&via=HowardStern&hashtags=bababooey
More information can you find in the documentation of the twitter web intents. From the Documentation:
Variable via:
A screen name to associate with the Tweet. The provided screen name will be appended to the end of the tweet with the text: "via #username" "Via" will be translated to the proper locality of the posting user, if supported. Potentially drives new followers to the target account.
Variable related:
Suggest accounts related to the your content or intention by comma-separating a list of screen names. After Tweeting, the user will be encouraged to follow these accounts.
Greetings.