ContactList ContactList ContactList ContactList Class

Definition

Represents a list of Contact objects.

public : sealed class ContactList : IContactList, IContactList2
public sealed class ContactList : IContactList, IContactList2
Public NotInheritable Class ContactList Implements IContactList, IContactList2
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
contactsSystem

Remarks

Call ContactStore.CreateContactListAsync to create a new instance of this class.

Properties

ChangeTracker ChangeTracker ChangeTracker ChangeTracker

Gets the app's ContactChangeTracker for this ContactList.

public : ContactChangeTracker ChangeTracker { get; }
public ContactChangeTracker ChangeTracker { get; }
Public ReadOnly Property ChangeTracker As ContactChangeTracker
var contactChangeTracker = contactList.changeTracker;
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
contactsSystem

DisplayName DisplayName DisplayName DisplayName

Gets or puts the name of the ContactList, suitable for display in the user interface.

public : Platform::String DisplayName { get; set; }
public string DisplayName { get; set; }
Public ReadWrite Property DisplayName As string
var string = contactList.displayName;
contactList.displayName = string;
Value
Platform::String string string string

The name of the ContactList, suitable for display in the user interface.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
contactsSystem

Id Id Id Id

Gets the locally unique identifier for this ContactList.

public : Platform::String Id { get; }
public string Id { get; }
Public ReadOnly Property Id As string
var string = contactList.id;
Value
Platform::String string string string

The locally unique identifier for this ContactList.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
contactsSystem

IsHidden IsHidden IsHidden IsHidden

Gets or puts a Boolean value indicating of the ContactList is hidden in the user interface.

public : Platform::Boolean IsHidden { get; set; }
public bool IsHidden { get; set; }
Public ReadWrite Property IsHidden As bool
var bool = contactList.isHidden;
contactList.isHidden = bool;
Value
Platform::Boolean bool bool bool

A Boolean value indicating of the ContactList is hidden in the user interface.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
contactsSystem

LimitedWriteOperations LimitedWriteOperations LimitedWriteOperations LimitedWriteOperations

Gets an object that provides operations that an app can perform on a contact list that it has not created.

public : ContactListLimitedWriteOperations LimitedWriteOperations { get; }
public ContactListLimitedWriteOperations LimitedWriteOperations { get; }
Public ReadOnly Property LimitedWriteOperations As ContactListLimitedWriteOperations
var contactListLimitedWriteOperations = contactList.limitedWriteOperations;
Value
ContactListLimitedWriteOperations ContactListLimitedWriteOperations ContactListLimitedWriteOperations ContactListLimitedWriteOperations

An object that provides operations that an app can perform on a contact list that it has not created.

Additional features and requirements
Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)
Capabilities
contactsSystem

OtherAppReadAccess OtherAppReadAccess OtherAppReadAccess OtherAppReadAccess

Gets or puts a value indicating the read access level to this ContactList for other apps on the system.

public : ContactListOtherAppReadAccess OtherAppReadAccess { get; set; }
public ContactListOtherAppReadAccess OtherAppReadAccess { get; set; }
Public ReadWrite Property OtherAppReadAccess As ContactListOtherAppReadAccess
var contactListOtherAppReadAccess = contactList.otherAppReadAccess;
contactList.otherAppReadAccess = contactListOtherAppReadAccess;
Value
ContactListOtherAppReadAccess ContactListOtherAppReadAccess ContactListOtherAppReadAccess ContactListOtherAppReadAccess

A value indicating the read access level to this ContactList for other apps on the system.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
contactsSystem

OtherAppWriteAccess OtherAppWriteAccess OtherAppWriteAccess OtherAppWriteAccess

Gets or puts a value indicating the write access level to this ContactList for other apps on the system.

public : ContactListOtherAppWriteAccess OtherAppWriteAccess { get; set; }
public ContactListOtherAppWriteAccess OtherAppWriteAccess { get; set; }
Public ReadWrite Property OtherAppWriteAccess As ContactListOtherAppWriteAccess
var contactListOtherAppWriteAccess = contactList.otherAppWriteAccess;
contactList.otherAppWriteAccess = contactListOtherAppWriteAccess;
Value
ContactListOtherAppWriteAccess ContactListOtherAppWriteAccess ContactListOtherAppWriteAccess ContactListOtherAppWriteAccess

A value indicating the write access level to this ContactList for other apps on the system.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
contactsSystem

SourceDisplayName SourceDisplayName SourceDisplayName SourceDisplayName

Gets the name of the source of the ContactList, suitable for display in the user interface.

public : Platform::String SourceDisplayName { get; }
public string SourceDisplayName { get; }
Public ReadOnly Property SourceDisplayName As string
var string = contactList.sourceDisplayName;
Value
Platform::String string string string

The name of the source of the ContactList, suitable for display in the user interface.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
contactsSystem

Remarks

This is usually the name of the app or service from which the contacts originate.

SupportsServerSearch SupportsServerSearch SupportsServerSearch SupportsServerSearch

Gets or sets a Boolean value indicating if you can search the remote server with this ContactList.

public : Platform::Boolean SupportsServerSearch { get; set; }
public bool SupportsServerSearch { get; set; }
Public ReadWrite Property SupportsServerSearch As bool
var bool = contactList.supportsServerSearch;
contactList.supportsServerSearch = bool;
Value
Platform::Boolean bool bool bool

A Boolean value indicating if you can search the remote server with this ContactList.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
contactsSystem

SyncConstraints SyncConstraints SyncConstraints SyncConstraints

Gets the ContactListSyncConstraints which indicates the maximum amount of contact list data that can be synchronized.

public : ContactListSyncConstraints SyncConstraints { get; }
public ContactListSyncConstraints SyncConstraints { get; }
Public ReadOnly Property SyncConstraints As ContactListSyncConstraints
var contactListSyncConstraints = contactList.syncConstraints;
Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)
Capabilities
contactsSystem

SyncManager SyncManager SyncManager SyncManager

Gets the ContactListSyncManager used to communicate with the server.

public : ContactListSyncManager SyncManager { get; }
public ContactListSyncManager SyncManager { get; }
Public ReadOnly Property SyncManager As ContactListSyncManager
var contactListSyncManager = contactList.syncManager;
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
contactsSystem

UserDataAccountId UserDataAccountId UserDataAccountId UserDataAccountId

Gets a string that represents the ID of the user data account for this ContactList.

public : Platform::String UserDataAccountId { get; }
public string UserDataAccountId { get; }
Public ReadOnly Property UserDataAccountId As string
var string = contactList.userDataAccountId;
Value
Platform::String string string string

A string that represents the ID of the user data account for this ContactList.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
contactsSystem

Methods

DeleteAsync() DeleteAsync() DeleteAsync() DeleteAsync()

Asynchronously deletes this ContactList, including all Contact objects in the ContactStore.

public : IAsyncAction DeleteAsync()
public IAsyncAction DeleteAsync()
Public Function DeleteAsync() As IAsyncAction
Windows.ApplicationModel.Contacts.ContactList.deleteAsync().done( /* Your success and error handlers */ );
Returns

An async action indicating that the method is complete.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
contactsSystem

DeleteContactAsync(Contact) DeleteContactAsync(Contact) DeleteContactAsync(Contact) DeleteContactAsync(Contact)

Asynchronously deletes and individual Contact from this ContactList and the ContactStore.

public : IAsyncAction DeleteContactAsync(Contact contact)
public IAsyncAction DeleteContactAsync(Contact contact)
Public Function DeleteContactAsync(contact As Contact) As IAsyncAction
Windows.ApplicationModel.Contacts.ContactList.deleteContactAsync(contact).done( /* Your success and error handlers */ );
Parameters
contact
Contact Contact Contact Contact

The Contact to delete.

Returns

An async action indicating that the method is complete.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
contactsSystem

GetChangeTracker(String) GetChangeTracker(String) GetChangeTracker(String) GetChangeTracker(String)

Gets a ContactChangeTracker that provides functionality for monitoring changes to Contact objects in the ContactList.

public : ContactChangeTracker GetChangeTracker(Platform::String identity)
public ContactChangeTracker GetChangeTracker(String identity)
Public Function GetChangeTracker(identity As String) As ContactChangeTracker
var contactChangeTracker = contactList.getChangeTracker(identity);
Parameters
identity
Platform::String String String String

A string that identifies the ContactChangeTracker instance in the ContactList.

Returns

A ContactChangeTracker that provides functionality for monitoring changes to Contact objects in the ContactList.

Additional features and requirements
Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)
Capabilities
contactsSystem

Remarks

You can create multiple ContactChangeTracker instances by using this method. If you pass in a string that identifies a ContactChangeTracker that already exists in the ContactList, this method returns that instance. If the string that you pass into this method does not identify an existing an existing ContactChangeTracker, this method returns a new ContactChangeTracker.

You can use the IsTracking property of the ContactChangeTracker to determine whether change tracking is enabled for the ContactChangeTracker.

GetContactAsync(String) GetContactAsync(String) GetContactAsync(String) GetContactAsync(String)

Asynchronously retrieves the specified Contact object from the ContactList.

public : IAsyncOperation<Contact> GetContactAsync(Platform::String contactId)
public IAsyncOperation<Contact> GetContactAsync(String contactId)
Public Function GetContactAsync(contactId As String) As IAsyncOperation( Of Contact )
Windows.ApplicationModel.Contacts.ContactList.getContactAsync(contactId).done( /* Your success and error handlers */ );
Parameters
contactId
Platform::String String String String

The string that identifies the Contact to return.

Returns
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
contactsSystem

GetContactFromRemoteIdAsync(String) GetContactFromRemoteIdAsync(String) GetContactFromRemoteIdAsync(String) GetContactFromRemoteIdAsync(String)

Asynchronously gets the Contact identified by the specified RemoteId.

public : IAsyncOperation<Contact> GetContactFromRemoteIdAsync(Platform::String remoteId)
public IAsyncOperation<Contact> GetContactFromRemoteIdAsync(String remoteId)
Public Function GetContactFromRemoteIdAsync(remoteId As String) As IAsyncOperation( Of Contact )
Windows.ApplicationModel.Contacts.ContactList.getContactFromRemoteIdAsync(remoteId).done( /* Your success and error handlers */ );
Parameters
remoteId
Platform::String String String String

An ID that can be used by a service provider to access the Contact in their remote system.

Returns
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
contactsSystem

GetContactReader() GetContactReader() GetContactReader() GetContactReader()

Gets a ContactReader object associated with this ContactList.

public : ContactReader GetContactReader()
public ContactReader GetContactReader()
Public Function GetContactReader() As ContactReader
var contactReader = contactList.getContactReader();
Returns
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
contactsSystem
See Also

GetContactReader(ContactQueryOptions) GetContactReader(ContactQueryOptions) GetContactReader(ContactQueryOptions) GetContactReader(ContactQueryOptions)

Gets a ContactReader object associated with this ContactList and using the specified ContactQueryOptions.

public : ContactReader GetContactReader(ContactQueryOptions options)
public ContactReader GetContactReader(ContactQueryOptions options)
Public Function GetContactReader(options As ContactQueryOptions) As ContactReader
var contactReader = contactList.getContactReader(options);
Parameters
Returns
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
contactsSystem
See Also

GetMeContactAsync() GetMeContactAsync() GetMeContactAsync() GetMeContactAsync()

Asynchronously gets the Contact object for the current user.

public : IAsyncOperation<Contact> GetMeContactAsync()
public IAsyncOperation<Contact> GetMeContactAsync()
Public Function GetMeContactAsync() As IAsyncOperation( Of Contact )
Windows.ApplicationModel.Contacts.ContactList.getMeContactAsync().done( /* Your success and error handlers */ );
Returns
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
contactsSystem

RegisterSyncManagerAsync() RegisterSyncManagerAsync() RegisterSyncManagerAsync() RegisterSyncManagerAsync()

Adds a SyncManager to the ContactList.

public : IAsyncAction RegisterSyncManagerAsync()
public IAsyncAction RegisterSyncManagerAsync()
Public Function RegisterSyncManagerAsync() As IAsyncAction
Windows.ApplicationModel.Contacts.ContactList.registerSyncManagerAsync().done( /* Your success and error handlers */ );
Returns

An asynchronous registration operation that you can await.

Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)
Capabilities
contactsSystem

Remarks

The SyncManager provides an entry point for other apps to call ContactList.SyncManager.SyncAsync. Calling ContactList.SyncManager.SyncAsync will launch the provider app as a background task and fire a IContactDataProviderConnection.SyncRequested event. An app should only call this method if they are set up as contact provider.

SaveAsync() SaveAsync() SaveAsync() SaveAsync()

Asynchronously saves this ContactList.

public : IAsyncAction SaveAsync()
public IAsyncAction SaveAsync()
Public Function SaveAsync() As IAsyncAction
Windows.ApplicationModel.Contacts.ContactList.saveAsync().done( /* Your success and error handlers */ );
Returns

An async action indicating that the method has completed.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
contactsSystem

SaveContactAsync(Contact) SaveContactAsync(Contact) SaveContactAsync(Contact) SaveContactAsync(Contact)

Asynchronously saves the specified Contact to the ContactStore.

public : IAsyncAction SaveContactAsync(Contact contact)
public IAsyncAction SaveContactAsync(Contact contact)
Public Function SaveContactAsync(contact As Contact) As IAsyncAction
Windows.ApplicationModel.Contacts.ContactList.saveContactAsync(contact).done( /* Your success and error handlers */ );
Parameters
contact
Contact Contact Contact Contact

The contact to save.

Returns

An async action indicating that the method has completed.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
contactsSystem

Remarks

Throws a System.ArgumentException: 'Value does not fall within the expected range.' when the contact passed as parameter has a RemoteID set which is identical to a contacts RemoteID already saved on this device.

Events

ContactChanged ContactChanged ContactChanged ContactChanged

Occurs when a Contact in this ContactList has been changed.

public : event TypedEventHandler ContactChanged<ContactList, ContactChangedEventArgs>
public event TypedEventHandler ContactChanged<ContactList, ContactChangedEventArgs>
Public Event TypedEventHandler ContactChanged( Of ( Of ContactList ), ( Of ContactChangedEventArgs ))
function onContactChanged(eventArgs){/* Your code */}


contactList.addEventListener("contactChanged", onContactChanged);
contactList.removeEventListener("contactChanged", onContactChanged);
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
contactsSystem