Search code examples
c#windows-phone-8.1contactssilverlight-5.0

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?


Solution

  • 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