简体   繁体   中英

Send a contact from my Windows-Store-App to People App to add it to Exchange account

Greetings fellow programmers!

I am developing a Windows-Store-App for Windows 8.1 in which i work with contact information. The user can take a picture of a business card and gets the data from it.

What I now want to do is adding this contact to an MS Exchange account. I know, in the People App which is preinstalled on the system, i can connect with some online account, like the Exchange account, and add contacts to it. You click this add button, type in the information you need, choose an account to add it to and submit.

Because I don't want to use the Exchange Web Services to access the account diretcly, i wanted to use this app as some kind of gateway to do that.

I have seen some posts which suggest to use ContactPicker and ContactPickerUI. I see that ContactPickerUI has a method to "add a contact". But I cannot find out where it gets added to. There is this sample app on msdn, which uses both classes and the AddContact Method, but all it does is showing on screen which contact you chose.

Can I maybe use the Share Charm to achieve this? Can someone tell me where the ContactPickerUI adds the contact to?

Thanks in advance.

PS: This is the first time i ask a question myself. If there is anything wrong with it, let me know.

I found a way to do it. With this way you can show the contact details inside your App and add it to the standard account configured in the people app.

First you need to set up a contact:

var newContact = new Contact();
newContact.FirstName = "Test";
newContact.LastName = "Test";
newContact.Addresses.Add(new ContactAddress() { StreetAddress = "Main Street 15",
                                                Country = "Exampleland",
                                                PostalCode = "1337",
                                                Locality = "Capital City" });

newContact.Phones.Add(new ContactPhone() { Description = "Home
                                           Number = "+666 465465464",
                                           Kind = ContactPhoneKind.Home });

newContact.Emails.Add(new ContactEmail() { Address = "Test@gmail.com" });

Then you use the static method ShowContactCard from ContactManager to display the contact:

ContactManager.ShowContactCard(newContact, new Rect(), Placement.Above);

You get something like this:

来自<code> ShowContactCard </ code>的结果

In the reight bottom corner you can click "Add Contact", or whatever it may be called in your application language, which opens the People App with the given contact details. Click save there and ready.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM