다음을 통해 공유


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

적용 대상

추가 정보