daleijn
daleijn

Reputation: 738

Add contact programmatically, with number phone

I want programmatically add a contact. I follow this. With this I can add all information about contact WITHOUT his number phone. Class StoredContact doesn't have 'phone number' property. I'm stuck on this. I know about SaveContactTask, but I want to save contact fully programmatically, without any user inputs. I know is possible, because exist app who doing it: FB, VK for example. Please, help me, how can I save full contact info with phone number programmatically, or tell me why I can't do it, and how some apps do it?

Upvotes: 0

Views: 1016

Answers (2)

Muhammad Saifullah
Muhammad Saifullah

Reputation: 4292

Did you tried following code?

  IDictionary<string, object> props = await contact.GetPropertiesAsync();
   props.Add(KnownContactProperties.Telephone, "yourtelephone");
        props.Add(KnownContactProperties.MobileTelephone, "mobileTele");
        props.Add(KnownContactProperties.AlternateMobileTelephone, "mobileTele");
        props.Add(KnownContactProperties.WorkTelephone, "mobileTele");
        props.Add(KnownContactProperties.AlternateWorkTelephone, "mobileTele");

Hope this helps

Upvotes: 0

DividedByZero
DividedByZero

Reputation: 4391

Try the Windows.ApplicationModel.Contacts namespace

Note: the Windows.ApplicationModel.Contacts namespace is only supported by WP8.1

Upvotes: 1

Related Questions