在C#中添加联系人到人们在Windows Phone 8.1 [英] Adding contacts to People on Windows Phone 8.1 in C#

查看:120
本文介绍了在C#中添加联系人到人们在Windows Phone 8.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法添加上的Windows Phone 8.1,从我的应用程序到应用程序的人交往?我看了看不同的东西Contact类之下,似乎没有任何工作。有不同的方式(如为ContactManager,ContactPicket等)来检索数据,但似乎没有让我补充,因为大多数的Microsoft.P​​hone.Tasks像SaveContactTask东西是不是对WP 8.1实现了一个新的联系人。

Is there a way to add contacts from my app to the People app on a Windows Phone 8.1? I looked at different things under the Contact class and nothing seems to work. There are different ways (like ContactManager, ContactPicket, etc.) to retrieve data but nothing seems to allow me to add a new contact as most of the stuff like SaveContactTask in Microsoft.Phone.Tasks is not implemented on WP 8.1.

学家

推荐答案

您不必主要联系人写访问在Windows Phone 8商店,但你必须创建你的自己的联系人存储了解,你可以用它来管理你自己的应用程序创建的联系人应用程序

You don't have write access to the primary contact store on Windows Phone 8, but you have the ability to create your own contact store for the app which you can use to manage contacts created in your own app.

的机制是非常简单的:

using Windows.Phone.PersonalInformation;

public async void addPerson() {
    var store = await ContactStore.CreateOrOpenAsync();

    var contact = new StoredContact(store) {
        DisplayName = "Mike Peterson"
    };
    var props = await contact.GetPropertiesAsync();
    props.add(KnownContactProperties.Email, "mike@peterson.com");
    props.add(KnownContactProperties.MobileTelephone, "+1 212 555 1234");

    await contact.SaveAsync();
}

要通知您提供联系信息操作系统,你需要添加 ID_CAP_CONTACTS /联系人功能来为您的应用程序(在appxmanifest的功能部分)。联系人保持到应用程序被删除。

To inform the OS that you provide contact information, you need to add the ID_CAP_CONTACTS/Contacts capability to your app (in the Capabilities section of the appxmanifest). Contacts remain until the app is removed.

私人,由应用中的联系人所拥有的方便的应用程序接触的数据。

Private, owned by the app contacts are convenient for 'contact' data for the app.

这篇关于在C#中添加联系人到人们在Windows Phone 8.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆