(1) Contact person (Manifest get permission)
1) Get Contacts
There are two ways to get a contact
A. Contactpicker
Contactpicker is the direct opening of a system to select the contact interface, let the user choose, you can set a single or multiple selection:
varContactpicker =NewContactpicker (); ContactPicker.DesiredFieldsWithContactFieldType.Add (contactfieldtype.phonenumber);//Windows.ApplicationModel.Contacts.Contact contact = await contactpicker.pickcontactsasync ();Windows.ApplicationModel.Contacts.Contact contact =awaitContactpicker.pickcontactasync ();if(Contact! =NULL) {Messagedialog dialog=NewMessagedialog (string. Format ("Phone number: {0}", contact. Phones.first (). Number), contact. DisplayName); awaitdialog. Showasync ();}
A unique contactfieldtype must be set.
B. Contactmanager
You can search for a contact directly via the Contactmanager API:
await Contactmanager.requeststoreasync (); var await Contactstore.findcontactsasync (SearchTextBox.Text.Trim ());
Gets the list of contacts as read-only.
2) Contact the contact person
You can make a call directly to a contact, send a text message, send an email:
Phonecallmanager.showphonecallui ("15911111111","Some"); Chatmessage message=Newchatmessage (); message. Recipients.add ("15911111111"); message. Body="Test.";awaitchatmessagemanager.showcomposesmsmessageasync (message); Emailmessage Email=Newemailmessage (); email. To.add (NewEmailrecipient ("[email protected]") ; email. Body="Test.";awaitEmailmanager.showcomposenewemailasync (email);
(2) Calendar
1) Open the system's calendar app directly
For example, open the Calendar main screen:
await Appointmentmanager.showtimeframeasync (Datetimeoffset.now, Timespan.fromhours (1));
2) API mode
For example, create a new calendar event:
New""= datetimeoffset.now; // ... await New Rect ());
More APIs: Links