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’ll learn about the Win32 Error “0x000019E5 – ERROR_COULD_NOT_RESIZE_LOG” that you get when debugging system erors in...
In this post, you’ll learn about the error “CO_E_DBERROR 0x8004E02B” that is returned when working with COM based APIs or...
In this post, you’ll learn about the Win32 Error “0x000019D0 – ERROR_LOG_BLOCK_VERSION” that you get when debugging system erors in...