ContactAnnotationStore
ContactAnnotationStore
ContactAnnotationStore
ContactAnnotationStore
Class
Definition
Represents a data store that contains contact annotations.
public : sealed class ContactAnnotationStore : IContactAnnotationStore, IContactAnnotationStore2public sealed class ContactAnnotationStore : IContactAnnotationStore, IContactAnnotationStore2Public NotInheritable Class ContactAnnotationStore Implements IContactAnnotationStore, IContactAnnotationStore2// You can use this class in JavaScript.
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
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 )// You can use this method in JavaScript.
The newly created ContactAnnotationList.
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;
}
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 )// You can use this method in JavaScript.
- 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.
The newly created ContactAnnotationList.
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.
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// You can use this method in JavaScript.
The annotation to disable.
An async action indicating that the operation has completed.
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( Of IReadOnlyListContactAnnotationList )// You can use this method in JavaScript.
The list of ContactAnnotationList objects.
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( Of IReadOnlyListContactAnnotation )// You can use this method in JavaScript.
The list of ContactAnnotation objects.
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( Of IReadOnlyListContactAnnotation )// You can use this method in JavaScript.
- contactListId
- PlatForm::String String String String
The ID of the ContactList for which to retrieve annotations.
The list of ContactAnnotation objects.
| Device family |
Windows 10 Creators Update (introduced v10.0.15063.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v4)
|
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( Of IReadOnlyListstring )// You can use this method in JavaScript.
- emailAddress
- PlatForm::String String String String
The email address used to find the contact Id values.
The list of Contact objects containing the specified emailAddress.
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( Of IReadOnlyListstring )// You can use this method in JavaScript.
- phoneNumber
- PlatForm::String String String String
The phone number used to find the contact Id values.
The list of Contact objects containing the specified phoneNumber.
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 )// You can use this method in JavaScript.
- annotationListId
- PlatForm::String String String String
The ID of the ContactAnnotationList to get.
The ContactAnnotationList with the ID specified in annotationListId.
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