ContactAnnotationStore.GetAnnotationListAsync(String) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
以非同步方式取得具有指定識別碼的 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 的識別碼。
傳回
ContactAnnotationList,其識別碼指定于annotationListId中。
- 屬性
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;
}