How to use SaveContactTask to save contact in Windows Phone ?

The Windows Phone SDK provides the SaveContactTask that enables the users to save a contact from your windows phone App .

To use the SaveContactTask , follow the below steps

1. Add the namespace “using Microsoft.Phone.Tasks;”

2. Declare Initialize the SaveContactTask along with the event handler for the Completed Event for SaveContactTask .

SaveContactTask SaveContact;
public MainPage()
{
InitializeComponent();
SaveContact = new SaveContactTask();
SaveContact.Completed += new EventHandler(SaveContact_Completed);
}
void SaveContact_Completed(object sender, SaveContactResult e)
{
if (e.TaskResult == TaskResult.OK)
{
MessageBox.Show("Saved");
}
}

3. Fill the necessary properties(optional) of the SaveContactTask that needs to be saved and call the show method of the SaveContact

SaveContact.FirstName = "senthil";
SaveContact.Website = "www.developerpublish.com";
SaveContact.Show();

4. This will show the Screen which enables the user to modify / update the properties . The user should click the save icon to save the contact .

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

In this post, you will learn about sync provider notifications in Windows 11 and how to disable or enable it...
In this tutorial, let’s learn how to enable or disable the startup sound in Windows 11. By default, when Windows...
The CameraCaptureTask allows the Windows Phone 7 App to launch the Camera Application . This will be useful when the...