ContactPickerUI.AddContact ContactPickerUI.AddContact ContactPickerUI.AddContact ContactPickerUI.AddContact ContactPickerUI.AddContact Method

Definition

Overloads

AddContact(Contact) AddContact(Contact) AddContact(Contact) AddContact(Contact) AddContact(Contact)

Adds a Contact.

Note

The Contact.Id property must be set when you call AddContact. If Contact.Id isn't set, your app will fail.

AddContact(String, Contact) AddContact(String, Contact) AddContact(String, Contact) AddContact(String, Contact) AddContact(String, Contact)

Note

AddContact may be altered or unavailable for releases after Windows 8.1. Instead, use AddContact without the ID.

Adds a Contact.

AddContact(Contact) AddContact(Contact) AddContact(Contact) AddContact(Contact) AddContact(Contact)

Adds a Contact.

Note

The Contact.Id property must be set when you call AddContact. If Contact.Id isn't set, your app will fail.

public : AddContactResult AddContact(Contact contact)
AddContactResult AddContact(Contact contact) const;
public AddContactResult AddContact(Contact contact)
Public Function AddContact(contact As Contact) As AddContactResult
var addContactResult = contactPickerUI.addContact(contact);
Parameters
contact
Contact Contact Contact

An object that contains the contact's information.

Returns

An AddContactResult -typed value that indicates whether the contact was added successfully.

Additional features and requirements
Capabilities
contactsSystem
See Also

AddContact(String, Contact) AddContact(String, Contact) AddContact(String, Contact) AddContact(String, Contact) AddContact(String, Contact)

Note

AddContact may be altered or unavailable for releases after Windows 8.1. Instead, use AddContact without the ID.

Adds a Contact.

public : AddContactResult AddContact(Platform::String id, Contact contact)
AddContactResult AddContact(winrt::hstring id, Contact contact) const;
public AddContactResult AddContact(String id, Contact contact)
Public Function AddContact(id As String, contact As Contact) As AddContactResult
var addContactResult = contactPickerUI.addContact(id, contact);
Parameters
id
String String String

The ID for the contact.

contact
Contact Contact Contact

An object that contains the contact's information.

Returns

An AddContactResult -typed value that indicates whether the contact was added successfully.

Additional features and requirements
Capabilities
contactsSystem

Examples

This example code adds a contact to the contact picker.

function addContact (sampleContact) {
// Generate the Contact object to be added
var contact = createContactForBasket(sampleContact);

// Add the Contact object to the basket
var statusMessage = document.getElementById("statusMessage");
     switch (contactPickerUI.addContact(contact)) {
     case Windows.ApplicationModel.Contacts.Provider.AddContactResult.added:
         // Notify user that the contact was added to the basket
         statusMessage.innerText = contact.displayName + " was added to the basket";
         break;
     case Windows.ApplicationModel.Contacts.Provider.AddContactResult.alreadyAdded:
         // Notify the user that the contact is already in the basket
         statusMessage.innerText = contact.displayName + " is already in the basket";
         break;
     case Windows.ApplicationModel.Contacts.Provider.AddContactResult.unavailable:
     default:
         // Notify the user that the basket is not currently available
         statusMessage.innerText = contact.displayName + " could not be added to the basket";
         break;
    }
}
See Also