The Unholy Metal Machine
The Unholy Metal Machine

Reputation: 1103

creating a contact with custom field?

I'm working on an UWP software which requires to manage a contacts list. Each contact must store at least one public key (hash) to identify themselves. I checked the API for UWP and it is quiet unclear for me how to do something like this.

for Windows8 phone there is StoredContact wich seems to be able to store custom fields. An example can be found at the page 16 of the presentation here : http://www.slideshare.net/WindowsPhoneRocks/16-interacting-with-user-data-contacts-and-appointments

for UWP, I tried first to add StoredContact. But I have no access to Windows::Phone::PersonalInformation (see namespace here : https://msdn.microsoft.com/en-us/library/windows/apps/jj207745.aspx). (n.b. I'm not targeting phone device).

then I tried to add custom field with Contact (https://msdn.microsoft.com/library/windows/apps/br224849) but at this point I have no idea how to. Since Windows::ApplicationModel::Contacts is sealed I cannot try to create a child class and adding a property HashKey.

Technicaly I could have a class HashKey wich is something like Windows::ApplicationModel::Contacts::ContactPhone.

If it's not possible to store custome field I really need to know it, because it's a critical issue for me.

msdn version : https://social.msdn.microsoft.com/Forums/windowsapps/en-US/d3886f74-3579-43b9-9870-a465c6ff51ea/creating-a-contact-with-custom-field-?forum=wpdevelop#d3886f74-3579-43b9-9870-a465c6ff51ea

Upvotes: 1

Views: 54

Answers (1)

Sunteen Wu
Sunteen Wu

Reputation: 10627

I replied your same question in MSDN, please see: https://social.msdn.microsoft.com/Forums/windowsapps/en-US/d3886f74-3579-43b9-9870-a465c6ff51ea/creating-a-contact-with-custom-field-?forum=wpdevelop.

Contact object is designed to not allowed add a new one but you can change the exist field.

Since you didn't mentioned you developing with C++ ,so I gave a C# code. Here is the simple C++ code sample:

ContactPhone^ phone1 =ref new ContactPhone();
phone1->Number = "secrectword";
phone1->Description = "password"; 
contact1->Phones->Append(phone1);

Upvotes: 1

Related Questions