HomeWindowsHow to use SaveContactTask to save contact in Windows Phone ?

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

You May Also Like

This blog post will guide you through several effective methods to troubleshoot and resolve the issue of Microsoft Edge not...
Windows 11 offers a range of audio enhancements that can enrich your listening experience. These enhancements include features like virtual...
Windows 11 brings a fresh and visually stunning design to your desktop, and one of the standout features is the...