StoredContact StoredContact StoredContact StoredContact Class

Represents a contact associated with a custom contact store.

Syntax

Declaration

public sealed class StoredContactpublic sealed class StoredContactPublic NotInheritable Class StoredContactpublic sealed class StoredContact

Remarks

You must open your app's contact store in order to obtain a StoredContact object. To work with contact information that is not yet associated with a store or to parse contact information from a vCard, use the ContactInformation class.

These APIs create or obtain a StoredContact object:

Constructors summary

Initializes a new instance of the StoredContact class.

Initializes a new instance of the StoredContact class and initializes the property values from the provided ContactInformation object.

Properties summary

Gets or sets the display name of a stored contact.

Gets the display picture of a stored contact.

Gets or sets the date that a display picture was created or modified. Used to enable sorting of display pictures by date.

Gets or sets the family name of the stored contact.

Gets or sets the given name of the stored contact.

Gets or sets the honorific prefix of the stored contact.

Gets or sets the honorific suffix of the stored contact.

Gets the local identifier of the stored contact.

Gets the remote identifier of the stored contact.

Gets the ContactStore in which the contact is stored.

Methods summary

Gets the display picture of a stored contact.

Gets the extended properties for a stored contact as an map of name/value pairs.

Gets the known properties for the contact.

Replaces the contact with the specified ID with the current contact.

Saves the current state of the contact to the contact store.

Sets the display picture for a contact using an IInputStream object.

Retrieves a vCard representation of the contact using the vCard version 3.0 format.

Retrieves a vCard representation of the contact using the specified vCard format.

Constructors

  • StoredContact(ContactStore)
    StoredContact(ContactStore)
    StoredContact(ContactStore)
    StoredContact(ContactStore)

    Initializes a new instance of the StoredContact class.

    public StoredContact(ContactStore store)public New(ContactStore store)Public Sub New(store As ContactStore)public StoredContact(ContactStore store)

    Parameters

  • StoredContact(ContactStore, ContactInformation)
    StoredContact(ContactStore, ContactInformation)
    StoredContact(ContactStore, ContactInformation)
    StoredContact(ContactStore, ContactInformation)

    Initializes a new instance of the StoredContact class and initializes the property values from the provided ContactInformation object.

    public StoredContact(ContactStore store, ContactInformation contact)public New(ContactStore store, ContactInformation contact)Public Sub New(store As ContactStore, contact As ContactInformation)public StoredContact(ContactStore store, ContactInformation contact)

    Parameters

Properties

  • DisplayName
    DisplayName
    DisplayName
    DisplayName

    Gets or sets the display name of a stored contact.

    public string DisplayName { get; set; }public string DisplayName { get; set; }Public ReadWrite Property DisplayName As stringpublic string DisplayName { get; set; }

    Property Value

    • string
      string
      string
      string

      The display name of a contact.

  • DisplayPicture
    DisplayPicture
    DisplayPicture
    DisplayPicture

    Gets the display picture of a stored contact.

    public IRandomAccessStreamReference DisplayPicture { get; }public IRandomAccessStreamReference DisplayPicture { get; }Public ReadOnly Property DisplayPicture As IRandomAccessStreamReferencepublic IRandomAccessStreamReference DisplayPicture { get; }

    Property Value

  • DisplayPictureDate
    DisplayPictureDate
    DisplayPictureDate
    DisplayPictureDate

    Gets or sets the date that a display picture was created or modified. Used to enable sorting of display pictures by date.

    public DateTime DisplayPictureDate { get; set; }public DateTimeOffset DisplayPictureDate { get; set; }Public ReadWrite Property DisplayPictureDate As DateTimeOffsetpublic DateTime DisplayPictureDate { get; set; }

    Property Value

  • FamilyName
    FamilyName
    FamilyName
    FamilyName

    Gets or sets the family name of the stored contact.

    public string FamilyName { get; set; }public string FamilyName { get; set; }Public ReadWrite Property FamilyName As stringpublic string FamilyName { get; set; }

    Property Value

    • string
      string
      string
      string

      The family name of the contact.

  • GivenName
    GivenName
    GivenName
    GivenName

    Gets or sets the given name of the stored contact.

    public string GivenName { get; set; }public string GivenName { get; set; }Public ReadWrite Property GivenName As stringpublic string GivenName { get; set; }

    Property Value

    • string
      string
      string
      string

      The given name of the contact.

  • HonorificPrefix
    HonorificPrefix
    HonorificPrefix
    HonorificPrefix

    Gets or sets the honorific prefix of the stored contact.

    public string HonorificPrefix { get; set; }public string HonorificPrefix { get; set; }Public ReadWrite Property HonorificPrefix As stringpublic string HonorificPrefix { get; set; }

    Property Value

    • string
      string
      string
      string

      The honorific prefix of the contact.

  • HonorificSuffix
    HonorificSuffix
    HonorificSuffix
    HonorificSuffix

    Gets or sets the honorific suffix of the stored contact.

    public string HonorificSuffix { get; set; }public string HonorificSuffix { get; set; }Public ReadWrite Property HonorificSuffix As stringpublic string HonorificSuffix { get; set; }

    Property Value

    • string
      string
      string
      string

      The honorific suffix of the contact.

  • Id
    Id
    Id
    Id

    Gets the local identifier of the stored contact.

    public string Id { get; }public string Id { get; }Public ReadOnly Property Id As stringpublic string Id { get; }

    Property Value

    • string
      string
      string
      string

      The local identifier of the contact.

    Remarks

    This identifier is assigned to the contact by the system. Your app can set a custom identifier by using the RemoteId property. Use this to associate contacts in the contact store with contacts in a remote, cloud-based contact store.

  • RemoteId
    RemoteId
    RemoteId
    RemoteId

    Gets the remote identifier of the stored contact.

    public string RemoteId { get; set; }public string RemoteId { get; set; }Public ReadWrite Property RemoteId As stringpublic string RemoteId { get; set; }

    Property Value

    • string
      string
      string
      string

      The remote identifier of the contact.

    Remarks

    Use this property to associate the Id of the contact with the identifier used by a remote, cloud-based contact store. The value of this property must be stable and must be unique across all apps on the phone. Attempting to save a contact may fail if the RemoteId property is not unique on the phone.

  • Store
    Store
    Store
    Store

    Gets the ContactStore in which the contact is stored.

    public ContactStore Store { get; }public ContactStore Store { get; }Public ReadOnly Property Store As ContactStorepublic ContactStore Store { get; }

    Property Value

Methods

  • GetDisplayPictureAsync()
    GetDisplayPictureAsync()
    GetDisplayPictureAsync()
    GetDisplayPictureAsync()

    Gets the display picture of a stored contact.

    public IAsyncOperation<IRandomAccessStream> GetDisplayPictureAsync()public IAsyncOperation<IRandomAccessStream> GetDisplayPictureAsync()Public Function GetDisplayPictureAsync() As IAsyncOperation( Of IRandomAccessStream )public IAsyncOperation<IRandomAccessStream> GetDisplayPictureAsync()

    Returns

  • GetExtendedPropertiesAsync()
    GetExtendedPropertiesAsync()
    GetExtendedPropertiesAsync()
    GetExtendedPropertiesAsync()

    Gets the extended properties for a stored contact as an map of name/value pairs.

    public IAsyncOperation<IMap<string, object>> GetExtendedPropertiesAsync()public IAsyncOperation<IMap<string, object>> GetExtendedPropertiesAsync()Public Function GetExtendedPropertiesAsync() As IAsyncOperation( Of IMapstring, object )public IAsyncOperation<IMap<string, object>> GetExtendedPropertiesAsync()

    Returns

    Remarks

    In the current release, the values stored in the collection returned by this method must be strings. The key names are app-defined and are not used by the operating system at all. To get the values for common properties, such as a contact address or telephone numbers that are used by the operating system, use GetPropertiesAsync() instead. The contents of the extended properties collection is saved when SaveAsync() is called.

  • GetPropertiesAsync()
    GetPropertiesAsync()
    GetPropertiesAsync()
    GetPropertiesAsync()

    Gets the known properties for the contact.

    public IAsyncOperation<IMap<string, object>> GetPropertiesAsync()public IAsyncOperation<IMap<string, object>> GetPropertiesAsync()Public Function GetPropertiesAsync() As IAsyncOperation( Of IMapstring, object )public IAsyncOperation<IMap<string, object>> GetPropertiesAsync()

    Returns

    Remarks

    The key names must be one of the properties of the KnownContactProperties class. To get values for arbitrary app-defined properties, use GetExtendedPropertiesAsync() instead. The contents of the collection is saved when SaveAsync() is called.

  • ReplaceExistingContactAsync(String)
    ReplaceExistingContactAsync(String)
    ReplaceExistingContactAsync(String)
    ReplaceExistingContactAsync(String)

    Replaces the contact with the specified ID with the current contact.

    public IAsyncAction ReplaceExistingContactAsync(String id)public IAsyncAction ReplaceExistingContactAsync(String id)Public Function ReplaceExistingContactAsync(id As String) As IAsyncActionpublic IAsyncAction ReplaceExistingContactAsync(String id)

    Parameters

    • id
      System.String
      System.String
      System.String
      System.String

      The ID of the contact to replace.

    Returns

  • SaveAsync()
    SaveAsync()
    SaveAsync()
    SaveAsync()

    Saves the current state of the contact to the contact store.

    public IAsyncAction SaveAsync()public IAsyncAction SaveAsync()Public Function SaveAsync() As IAsyncActionpublic IAsyncAction SaveAsync()

    Returns

  • SetDisplayPictureAsync(IInputStream)
    SetDisplayPictureAsync(IInputStream)
    SetDisplayPictureAsync(IInputStream)
    SetDisplayPictureAsync(IInputStream)

    Sets the display picture for a contact using an IInputStream object.

    public IAsyncAction SetDisplayPictureAsync(IInputStream stream)public IAsyncAction SetDisplayPictureAsync(IInputStream stream)Public Function SetDisplayPictureAsync(stream As IInputStream) As IAsyncActionpublic IAsyncAction SetDisplayPictureAsync(IInputStream stream)

    Parameters

    Returns

  • ToVcardAsync()
    ToVcardAsync()
    ToVcardAsync()
    ToVcardAsync()

    Retrieves a vCard representation of the contact using the vCard version 3.0 format.

    public IAsyncOperation<IRandomAccessStream> ToVcardAsync()public IAsyncOperation<IRandomAccessStream> ToVcardAsync()Public Function ToVcardAsync() As IAsyncOperation( Of IRandomAccessStream )public IAsyncOperation<IRandomAccessStream> ToVcardAsync()

    Returns

  • ToVcardAsync(VCardFormat)
    ToVcardAsync(VCardFormat)
    ToVcardAsync(VCardFormat)
    ToVcardAsync(VCardFormat)

    Retrieves a vCard representation of the contact using the specified vCard format.

    public IAsyncOperation<IRandomAccessStream> ToVcardAsync(VCardFormat format)public IAsyncOperation<IRandomAccessStream> ToVcardAsync(VCardFormat format)Public Function ToVcardAsync(format As VCardFormat) As IAsyncOperation( Of IRandomAccessStream )public IAsyncOperation<IRandomAccessStream> ToVcardAsync(VCardFormat format)

    Parameters

    Returns

Device family

Windows Mobile Extension SDK (introduced v10.0.10240.0)

API contract

Windows.Phone.PhoneContract (introduced v1)

Capabilities

ID_CAP_CONTACTS [Windows Phone]

Attributes

Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute

Details

Assembly

Windows.Phone.PersonalInformation.dll