Add contacts on Windows Phone

Source: Internet
Author: User

We have previously introduced how to obtain contact information by using APIs provided by Windows Phone SDK 7.1. However, there is no direct API for adding contacts. We can only use the selector (Choosers) to add contact information.
SaveContactTask provides methods and events for starting the Contact application and enabling the user to save the contact. An example of code writing is as follows.
1. Create a selector and add the selector operation completion event (Completed)
SaveContactTask saveContact = new SaveContactTask ();
SaveContact. Completed + = new EventHandler <SaveContactResult> (saveCompleted );
2. assign values to the selector (contact information) and call the selector
SaveContact. FirstName = "Yu zhile ";
SaveContact. MobilePhone = "13888888888 ";
SaveContact. HomeAddressStreet = "Nanjing City, Jiangsu Province ";
SaveContact. PersonalEmail = "huizhang212@163.com ";
SaveContact. Show ();
3. selector operation completion event
Void saveCompleted (object sender, SaveContactResult e)
{
Switch (e. TaskResult)
{
Case TaskResult. OK:
MessageBox. Show ("the contact is saved successfully! ");
Break;
Case TaskResult. Cancel:
MessageBox. Show ("the user canceled the operation! ");
Break;
Case TaskResult. None:
MessageBox. Show ("the contact is not saved! ");
Break;
}
}

Currently, you can only query and add Contacts. You cannot modify or delete contacts. Only one user can manually process it through the system.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.