Contact.Name | name property

Applies to Windows and Windows Phone

[Name may be altered or unavailable for releases after Windows 8.1. Instead, use FirstName. ]

Sets and gets the name of the contact.

Syntax


var name = contact.name;
contact.name = name;

Property value

Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]

The name of the contact.

Remarks

An app can set the name property to any value that matches the name of a contact. We recommend that you set this value to contain both the first and last names of the contact, if that information is available.

Examples

This example shows a function taking the name property and returning the first and last names of the contact.


function getFirstAndLastName(contact) {
    var name = contact.name;
    if (name.indexOf(" ") != -1) {
        var firstAndLast = name.split(" ");
        return {
            first: firstAndLast[0],
            last: firstAndLast[1]
        };
    } else {
        return null;
    }
}


Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.ApplicationModel.Contacts
Windows::ApplicationModel::Contacts [C++]

Metadata

Windows.winmd

See also

Contact

 

 

Show:
© 2014 Microsoft