ContactAnnotationStore ContactAnnotationStore ContactAnnotationStore ContactAnnotationStore Class

Definition

Represents a data store that contains contact annotations.

public : sealed class ContactAnnotationStore : IContactAnnotationStore, IContactAnnotationStore2
public sealed class ContactAnnotationStore : IContactAnnotationStore, IContactAnnotationStore2
Public NotInheritable Class ContactAnnotationStore Implements IContactAnnotationStore, IContactAnnotationStore2
// 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 ContactManager.RequestAnnotationStoreAsync to get an instance of ContactAnnotationStore.

Methods

CreateAnnotationListAsync() CreateAnnotationListAsync() CreateAnnotationListAsync() CreateAnnotationListAsync()

Asynchronously creates a ContactAnnotationList.

public : IAsyncOperation<ContactAnnotationList> CreateAnnotationListAsync()
public IAsyncOperation<ContactAnnotationList> CreateAnnotationListAsync()
Public Function CreateAnnotationListAsync() As IAsyncOperation( Of ContactAnnotationList )
Windows.ApplicationModel.Contacts.ContactAnnotationStore.createAnnotationListAsync().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

Examples

The following example provides reusable methods for creating an annotation list, deleting a specific annotation list, and deleting all annotation lists in a store.

public async Task<ContactAnnotationList> CreateAnnotationList()
{
    // Get the data store.
    ContactAnnotationStore store = await ContactManager.RequestAnnotationStoreAsync(ContactAnnotationStoreAccessType.AppAnnotationsReadWrite);

    // Create a new list.
    ContactAnnotationList list = await store.CreateAnnotationListAsync();

    // Find the list to verify it was created.
    IReadOnlyList<ContactAnnotationList> lists = await store.FindAnnotationListsAsync();

    for (int i = 0; i < lists.Count; i++)
    {
        // Do the IDs match?
        if (list.Id == lists[i].Id)
        {
            // Found it! Return the new list.
            return(list);
        }
    }

    // List not created, return null.
    return(null);
}

public async Task<Boolean> DeleteAnnotationList(string listId)
{
    // Get the store.
    ContactAnnotationStore store = await ContactManager.RequestAnnotationStoreAsync(ContactAnnotationStoreAccessType.AppAnnotationsReadWrite);

    // Find the list.
    ContactAnnotationList list = await store.GetAnnotationListAsync(listId);

    // Make sure we got it.
    if (list.Id == listId)
    {
        // Delete the list.
        await list.DeleteAsync();
        return true;
    }

    return false;
}

public async Task<Boolean> DeleteAllAnnotationLists()
{
    // Get the store.
    ContactAnnotationStore store = await ContactManager.RequestAnnotationStoreAsync(ContactAnnotationStoreAccessType.AppAnnotationsReadWrite);

    IReadOnlyList<ContactAnnotationList> lists = await store.FindAnnotationListsAsync();

    // Make sure at least one annotation list exists.
    if (lists.Count > 0)
    {
        // Find the list.
        for (int i = 0; i < lists.Count; i++)
        {
            await lists[i].DeleteAsync();
        }

        return true;
    }

    return false;
}
See Also

CreateAnnotationListAsync(String) CreateAnnotationListAsync(String) CreateAnnotationListAsync(String) CreateAnnotationListAsync(String)

Asynchronously creates a ContactAnnotationList and associates it with the specified user data account ID.

public : IAsyncOperation<ContactAnnotationList> CreateAnnotationListAsync(Platform::String userDataAccountId)
public IAsyncOperation<ContactAnnotationList> CreateAnnotationListAsync(String userDataAccountId)
Public Function CreateAnnotationListAsync(userDataAccountId As String) As IAsyncOperation( Of ContactAnnotationList )
Windows.ApplicationModel.Contacts.ContactAnnotationStore.createAnnotationListAsync(userDataAccountId).done( /* Your success and error handlers */ );
Parameters
userDataAccountId
Platform::String String String String

The ID for the user data account with which to associate the new ContactAnnotationList. The user data account must be owned by this app.

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

Examples

The following example provides reusable methods for creating an annotation list, deleting a specific annotation list, and deleting all annotation lists in a store.

public async Task<ContactAnnotationList> CreateAnnotationList()
{
    // Get the data store.
    ContactAnnotationStore store = await ContactManager.RequestAnnotationStoreAsync(ContactAnnotationStoreAccessType.AppAnnotationsReadWrite);

    // Create a new list.
    ContactAnnotationList list = await store.CreateAnnotationListAsync();

    // Find the list to verify it was created.
    IReadOnlyList<ContactAnnotationList> lists = await store.FindAnnotationListsAsync();

    for (int i = 0; i < lists.Count; i++)
    {
        // Do the IDs match?
        if (list.Id == lists[i].Id)
        {
            // Found it! Return the new list.
            return(list);
        }
    }

    // List not created, return null.
    return(null);
}

public async Task<Boolean> DeleteAnnotationList(string listId)
{
    // Get the store.
    ContactAnnotationStore store = await ContactManager.RequestAnnotationStoreAsync(ContactAnnotationStoreAccessType.AppAnnotationsReadWrite);

    // Find the list.
    ContactAnnotationList list = await store.GetAnnotationListAsync(listId);

    // Make sure we got it.
    if (list.Id == listId)
    {
        // Delete the list.
        await list.DeleteAsync();
        return true;
    }

    return false;
}

public async Task<Boolean> DeleteAllAnnotationLists()
{
    // Get the store.
    ContactAnnotationStore store = await ContactManager.RequestAnnotationStoreAsync(ContactAnnotationStoreAccessType.AppAnnotationsReadWrite);

    IReadOnlyList<ContactAnnotationList> lists = await store.FindAnnotationListsAsync();

    // Make sure at least one annotation list exists.
    if (lists.Count > 0)
    {
        // Find the list.
        for (int i = 0; i < lists.Count; i++)
        {
            await lists[i].DeleteAsync();
        }

        return true;
    }

    return false;
}

Remarks

The user data account specified in userDataAccountId must be owned this app.

See Also

DisableAnnotationAsync(ContactAnnotation) DisableAnnotationAsync(ContactAnnotation) DisableAnnotationAsync(ContactAnnotation) DisableAnnotationAsync(ContactAnnotation)

Asynchronously disables the specified ContactAnnotation, usually as a result of user input.

public : IAsyncAction DisableAnnotationAsync(ContactAnnotation annotation)
public IAsyncAction DisableAnnotationAsync(ContactAnnotation annotation)
Public Function DisableAnnotationAsync(annotation As ContactAnnotation) As IAsyncAction
Windows.ApplicationModel.Contacts.ContactAnnotationStore.disableAnnotationAsync(annotation).done( /* Your success and error handlers */ );
Parameters
Returns

An async action indicating that the operation has completed.

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

FindAnnotationListsAsync() FindAnnotationListsAsync() FindAnnotationListsAsync() FindAnnotationListsAsync()

Asynchronously gets the list of ContactAnnotationList objects for the app.

public : IAsyncOperation<IVectorView<ContactAnnotationList>> FindAnnotationListsAsync()
public IAsyncOperation<IReadOnlyList<ContactAnnotationList>> FindAnnotationListsAsync()
Public Function FindAnnotationListsAsync() As IAsyncOperation<IReadOnlyList<ContactAnnotationList>>( Of IVectorView )
Windows.ApplicationModel.Contacts.ContactAnnotationStore.findAnnotationListsAsync().done( /* Your success and error handlers */ );
Returns
IAsyncOperation<IVectorView<ContactAnnotationList>> IAsyncOperation<IReadOnlyList<ContactAnnotationList>> IAsyncOperation<IReadOnlyList<ContactAnnotationList>> IAsyncOperation<IReadOnlyList<ContactAnnotationList>>

The list of ContactAnnotationList objects.

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

Examples

The following example provides reusable methods for creating an annotation list, deleting a specific annotation list, and deleting all annotation lists in a store.

public async Task<ContactAnnotationList> CreateAnnotationList()
{
    // Get the data store.
    ContactAnnotationStore store = await ContactManager.RequestAnnotationStoreAsync(ContactAnnotationStoreAccessType.AppAnnotationsReadWrite);

    // Create a new list.
    ContactAnnotationList list = await store.CreateAnnotationListAsync();

    // Find the list to verify it was created.
    IReadOnlyList<ContactAnnotationList> lists = await store.FindAnnotationListsAsync();

    for (int i = 0; i < lists.Count; i++)
    {
        // Do the IDs match?
        if (list.Id == lists[i].Id)
        {
            // Found it! Return the new list.
            return(list);
        }
    }

    // List not created, return null.
    return(null);
}

public async Task<Boolean> DeleteAnnotationList(string listId)
{
    // Get the store.
    ContactAnnotationStore store = await ContactManager.RequestAnnotationStoreAsync(ContactAnnotationStoreAccessType.AppAnnotationsReadWrite);

    // Find the list.
    ContactAnnotationList list = await store.GetAnnotationListAsync(listId);

    // Make sure we got it.
    if (list.Id == listId)
    {
        // Delete the list.
        await list.DeleteAsync();
        return true;
    }

    return false;
}

public async Task<Boolean> DeleteAllAnnotationLists()
{
    // Get the store.
    ContactAnnotationStore store = await ContactManager.RequestAnnotationStoreAsync(ContactAnnotationStoreAccessType.AppAnnotationsReadWrite);

    IReadOnlyList<ContactAnnotationList> lists = await store.FindAnnotationListsAsync();

    // Make sure at least one annotation list exists.
    if (lists.Count > 0)
    {
        // Find the list.
        for (int i = 0; i < lists.Count; i++)
        {
            await lists[i].DeleteAsync();
        }

        return true;
    }

    return false;
}
See Also

FindAnnotationsForContactAsync(Contact) FindAnnotationsForContactAsync(Contact) FindAnnotationsForContactAsync(Contact) FindAnnotationsForContactAsync(Contact)

Get the annotations for the specified Contact.

public : IAsyncOperation<IVectorView<ContactAnnotation>> FindAnnotationsForContactAsync(Contact contact)
public IAsyncOperation<IReadOnlyList<ContactAnnotation>> FindAnnotationsForContactAsync(Contact contact)
Public Function FindAnnotationsForContactAsync(contact As Contact) As IAsyncOperation<IReadOnlyList<ContactAnnotation>>( Of IVectorView )
Windows.ApplicationModel.Contacts.ContactAnnotationStore.findAnnotationsForContactAsync(contact).done( /* Your success and error handlers */ );
Parameters
contact
Contact Contact Contact Contact

The Contact for which to retrieve annotations.

Returns
IAsyncOperation<IVectorView<ContactAnnotation>> IAsyncOperation<IReadOnlyList<ContactAnnotation>> IAsyncOperation<IReadOnlyList<ContactAnnotation>> IAsyncOperation<IReadOnlyList<ContactAnnotation>>

The list of ContactAnnotation objects.

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

FindAnnotationsForContactListAsync(String) FindAnnotationsForContactListAsync(String) FindAnnotationsForContactListAsync(String) FindAnnotationsForContactListAsync(String)

Gets the annotations for the specified ContactList.

public : IAsyncOperation<IVectorView<ContactAnnotation>> FindAnnotationsForContactListAsync(Platform::String contactListId)
public IAsyncOperation<IReadOnlyList<ContactAnnotation>> FindAnnotationsForContactListAsync(String contactListId)
Public Function FindAnnotationsForContactListAsync(contactListId As String) As IAsyncOperation<IReadOnlyList<ContactAnnotation>>( Of IVectorView )
Windows.ApplicationModel.Contacts.ContactAnnotationStore.findAnnotationsForContactListAsync(contactListId).done( /* Your success and error handlers */ );
Parameters
contactListId
Platform::String String String String

The ID of the ContactList for which to retrieve annotations.

Returns
IAsyncOperation<IVectorView<ContactAnnotation>> IAsyncOperation<IReadOnlyList<ContactAnnotation>> IAsyncOperation<IReadOnlyList<ContactAnnotation>> IAsyncOperation<IReadOnlyList<ContactAnnotation>>

The list of ContactAnnotation objects.

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

FindContactIdsByEmailAsync(String) FindContactIdsByEmailAsync(String) FindContactIdsByEmailAsync(String) FindContactIdsByEmailAsync(String)

Gets a list of Id values based on Contact objects with a specified email address.

public : IAsyncOperation<IVectorView<Platform::String>> FindContactIdsByEmailAsync(Platform::String emailAddress)
public IAsyncOperation<IReadOnlyList<string>> FindContactIdsByEmailAsync(String emailAddress)
Public Function FindContactIdsByEmailAsync(emailAddress As String) As IAsyncOperation<IReadOnlyList<string>>( Of IVectorView )
Windows.ApplicationModel.Contacts.ContactAnnotationStore.findContactIdsByEmailAsync(emailAddress).done( /* Your success and error handlers */ );
Parameters
emailAddress
Platform::String String String String

The email address used to find the contact Id values.

Returns
IAsyncOperation<IVectorView<Platform::String>> IAsyncOperation<IReadOnlyList<string>> IAsyncOperation<IReadOnlyList<string>> IAsyncOperation<IReadOnlyList<string>>

The list of Contact objects containing the specified emailAddress.

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

FindContactIdsByPhoneNumberAsync(String) FindContactIdsByPhoneNumberAsync(String) FindContactIdsByPhoneNumberAsync(String) FindContactIdsByPhoneNumberAsync(String)

Gets a list of Id values based on Contact objects with a specified phone number.

public : IAsyncOperation<IVectorView<Platform::String>> FindContactIdsByPhoneNumberAsync(Platform::String phoneNumber)
public IAsyncOperation<IReadOnlyList<string>> FindContactIdsByPhoneNumberAsync(String phoneNumber)
Public Function FindContactIdsByPhoneNumberAsync(phoneNumber As String) As IAsyncOperation<IReadOnlyList<string>>( Of IVectorView )
Windows.ApplicationModel.Contacts.ContactAnnotationStore.findContactIdsByPhoneNumberAsync(phoneNumber).done( /* Your success and error handlers */ );
Parameters
phoneNumber
Platform::String String String String

The phone number used to find the contact Id values.

Returns
IAsyncOperation<IVectorView<Platform::String>> IAsyncOperation<IReadOnlyList<string>> IAsyncOperation<IReadOnlyList<string>> IAsyncOperation<IReadOnlyList<string>>

The list of Contact objects containing the specified phoneNumber.

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

GetAnnotationListAsync(String) GetAnnotationListAsync(String) GetAnnotationListAsync(String) GetAnnotationListAsync(String)

Asynchronously gets the ContactAnnotationList with the specified ID.

public : IAsyncOperation<ContactAnnotationList> GetAnnotationListAsync(Platform::String annotationListId)
public IAsyncOperation<ContactAnnotationList> GetAnnotationListAsync(String annotationListId)
Public Function GetAnnotationListAsync(annotationListId As String) As IAsyncOperation( Of ContactAnnotationList )
Windows.ApplicationModel.Contacts.ContactAnnotationStore.getAnnotationListAsync(annotationListId).done( /* Your success and error handlers */ );
Parameters
annotationListId
Platform::String String String String

The ID of the ContactAnnotationList to get.

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

Examples

The following example provides reusable methods for creating an annotation list, deleting a specific annotation list, and deleting all annotation lists in a store.

public async Task<ContactAnnotationList> CreateAnnotationList()
{
    // Get the data store.
    ContactAnnotationStore store = await ContactManager.RequestAnnotationStoreAsync(ContactAnnotationStoreAccessType.AppAnnotationsReadWrite);

    // Create a new list.
    ContactAnnotationList list = await store.CreateAnnotationListAsync();

    // Find the list to verify it was created.
    IReadOnlyList<ContactAnnotationList> lists = await store.FindAnnotationListsAsync();

    for (int i = 0; i < lists.Count; i++)
    {
        // Do the IDs match?
        if (list.Id == lists[i].Id)
        {
            // Found it! Return the new list.
            return(list);
        }
    }

    // List not created, return null.
    return(null);
}

public async Task<Boolean> DeleteAnnotationList(string listId)
{
    // Get the store.
    ContactAnnotationStore store = await ContactManager.RequestAnnotationStoreAsync(ContactAnnotationStoreAccessType.AppAnnotationsReadWrite);

    // Find the list.
    ContactAnnotationList list = await store.GetAnnotationListAsync(listId);

    // Make sure we got it.
    if (list.Id == listId)
    {
        // Delete the list.
        await list.DeleteAsync();
        return true;
    }

    return false;
}

public async Task<Boolean> DeleteAllAnnotationLists()
{
    // Get the store.
    ContactAnnotationStore store = await ContactManager.RequestAnnotationStoreAsync(ContactAnnotationStoreAccessType.AppAnnotationsReadWrite);

    IReadOnlyList<ContactAnnotationList> lists = await store.FindAnnotationListsAsync();

    // Make sure at least one annotation list exists.
    if (lists.Count > 0)
    {
        // Find the list.
        for (int i = 0; i < lists.Count; i++)
        {
            await lists[i].DeleteAsync();
        }

        return true;
    }

    return false;
}
See Also