次の方法で共有


ContactAnnotationStore.GetAnnotationListAsync(String) メソッド

定義

指定した ID を持つ ContactAnnotationList を非同期に取得します。

public:
 virtual IAsyncOperation<ContactAnnotationList ^> ^ GetAnnotationListAsync(Platform::String ^ annotationListId) = GetAnnotationListAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<ContactAnnotationList> GetAnnotationListAsync(winrt::hstring const& annotationListId);
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<ContactAnnotationList> GetAnnotationListAsync(string annotationListId);
function getAnnotationListAsync(annotationListId)
Public Function GetAnnotationListAsync (annotationListId As String) As IAsyncOperation(Of ContactAnnotationList)

パラメーター

annotationListId
String

Platform::String

winrt::hstring

取得する ContactAnnotationList の ID。

戻り値

annotationListId で指定された ID を持つ ContactAnnotationList

属性

Windows の要件

アプリの機能
contactsSystem

次の例では、注釈リストの作成、特定の注釈リストの削除、ストア内のすべての注釈リストの削除を行う再利用可能なメソッドを提供します。

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;
}

適用対象

こちらもご覧ください