Read contacts contacts agenda iPhone using Xamarin

Asked

Viewed 494 times

8

How do I read the contact list in my iPhone phone book using Xamarin?

I need to read the contact list of the iPhone agenda. I do not know how to do and I did not find any Portuguese material on the subject. Can someone help me in this matter?

  • 1

    I do not consider them duplicated, they are separate things and the one proposed in the other question is not possible.

  • 2

    The quality is very low. It would be good to change the title that is only with Keywords. If we signal, any moderator gets the warning or just Gabe?

  • @Victorhugo There are things we can do without moderation: edit, vote against, vote to close (or any combination of the three). I voted to close (as too broad). What Gabe could do would close immediately or delete.

  • 2

    I put this question (and her sisters) under discussion at the goal: http://meta.answall.com/questions/521/tres-questions-broadquestions-whatever to do

  • 3

    People, the notification that there is an answer in the question of Call logs on iPhone does not proceed. They are different things. The answer in question is correct, but the answer to this question is the one below. There are other ways to do this as well. Anyway it should not be marked as duplicate of the other. One is about logging the call history another is about getting access to the contact list from the user’s calendar on iPhone.

  • Guys, can anyone else vote to reopen this issue so we can leave corrected the issue since several users do not consider it duplicate?

Show 1 more comment

1 answer

9

1 - Install an Abaddressbook.

using(var addressBook = new ABAddressBook ()){ … }

2 - Call Getpeoplewithname, passing the name of the contact to search. This method returns an array of Abperson objects.

var people = addressBook.GetPeopleWithName ("John Doe");
people.ToList ().ForEach (
       p => Console.WriteLine ("{0} {1} - ", p.FirstName, p.LastName));

Together with Getpeoplewithname, Abaddressbook we have the Getpeople method. Using Linq, the result can be filtered based on some cryerium, as shown:

var people = addressBook.GetPeople ();
people.ToList ().FindAll (p => p.LastName == "Smith").ForEach (
       p => Console.WriteLine ("{0} {1}", p.FirstName, p.LastName));

Source: http://docs.xamarin.com/recipes/ios/shared_resources/contacts/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.