user3415421
user3415421

Reputation: 215

how to pick contacts from phonebook in windows phone 8 and use that contact in our app

I m working on windows phone 8 with phonegap. I want to pick the contacts from phonebook and want to use that contacts in my app. I gone through this link

but here i just can only search but i cant pick it and use it in my app.

I tried one sample contact picker also from microsft website but it shows only the list of phonebook but i cant pick it.so please anybody can help me for this. thanks

Upvotes: 1

Views: 900

Answers (2)

ua741
ua741

Reputation: 1466

According to your requirement mentioned in comment.

Use PhoneNumberChooserTask and on it's success, use SMS Composer task http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394021(v=vs.105).aspx

       private void SendInviteViaSMS(){

        var phoneNumberChooserTask= new PhoneNumberChooserTask();
        phoneNumberChooserTask.Completed += PhoneNumberChooserTaskOnCompleted;
        phoneNumberChooserTask.Show();
    }

    private void PhoneNumberChooserTaskOnCompleted(object sender, PhoneNumberResult phoneNumberResult)
    {
        if (phoneNumberResult.TaskResult == TaskResult.OK)
        {

            Debug.WriteLine("The phone number for " + phoneNumberResult.DisplayName + " is " + phoneNumberResult.PhoneNumber);
            var smsComposeTask = new SmsComposeTask();
            smsComposeTask.To = phoneNumberResult.PhoneNumber;
            smsComposeTask.Body = String.Format(" Hey {0}, Try this new application. It's great!",phoneNumberResult.DisplayName);
            smsComposeTask.Show();
        }
    }

Upvotes: 3

webdev
webdev

Reputation: 113

Have you tried this plugin -

https://github.com/apache/cordova-plugin-contacts/blob/dev/doc/index.md

It support Windows Phone 8.

Upvotes: 0

Related Questions