ContactAnnotationList.DeleteAsync Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Asynchronously deletes this ContactAnnotationList from the ContactAnnotationStore.
public:
virtual IAsyncAction ^ DeleteAsync() = DeleteAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncAction DeleteAsync();
C#
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncAction DeleteAsync();
function deleteAsync()
Public Function DeleteAsync () As IAsyncAction
An async action indicating that the operation has completed.
- Attributes
App capabilities |
contactsSystem
|
The following example provides reusable methods for creating an annotation list, deleting a specific annotation list, and deleting all annotation lists in a store.
C#
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;
}
Product | Versions |
---|---|
WinRT | Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100 |