Dela via


ContactManager.ShowContactCard Method

Definition

Overloads

ShowContactCard(Contact, Rect)

Queries the operating system for a user’s contact and shows the contact data in a contact card.

ShowContactCard(Contact, Rect, Placement)

Queries the operating system for a user’s contact and shows the contact data in a contact card.

ShowContactCard(Contact, Rect, Placement, ContactCardOptions)

Shows a contact card with the specified parameters.

ShowContactCard(Contact, Rect)

Queries the operating system for a user’s contact and shows the contact data in a contact card.

public:
 static void ShowContactCard(Contact ^ contact, Rect selection);
/// [Windows.Foundation.Metadata.Overload("ShowContactCard")]
 static void ShowContactCard(Contact const& contact, Rect const& selection);
[Windows.Foundation.Metadata.Overload("ShowContactCard")]
public static void ShowContactCard(Contact contact, Rect selection);
function showContactCard(contact, selection)
Public Shared Sub ShowContactCard (contact As Contact, selection As Rect)

Parameters

contact
Contact

The object that represents the contact that the app wants to display the contact card for.contact must contain at least an Id, Emails, or a phone number from a Phones list to query the user’s contact database to retrieve a matching contact to display. Id has higher priority for querying. If an Id matches, the rest of query parameters will be ignored for matching purposes. If an Id does not find a match, the query uses the rest of query parameters. Emails and Phones have equal priority for matching. If multiple email addresses, or phone numbers, or both are provided, the query first performs an exact match, requiring all query parameters to match a system contact record. If this results in no matches, the query uses "best effort" match, in which a match of any query parameters is sufficient.

If no matches occur, the data in the input contact displays in the contact card. If a match occurs, only system contact data displays, and the data in the input contact is discarded.

selection
Rect

The Rect is the rectangular area of user selection (for example, pressing a button), around which the operating system displays the contact card, not within that rectangular area. For example, if an app uses a button to show the contact card, pass the Rect of the button so the contact card displays around the button, not overlapping it.

Attributes

Windows requirements

App capabilities
contactsSystem

Remarks

Note

Source apps must be running in the foreground to call this method. An app that runs in the background will get an "Access Denied" exception if it calls this method.

Most typical operations will result in displaying a UI.

  • If there is one exact match for the requested contact: Shows the contact card UI with information from the contacts store in the operating system.
  • If there are multiple matches: Shows the contact card UI for the first matching contact found.
  • If there is no match: Shows the contact card UI, where the contact info comes from the input contact object.

If there's an error, such as an invalid input for the contact parameter, no UI is displayed.

For querying purposes, phone numbers support characters 0-9 and a-z/A-Z. If you put any other characters in a phone number, they are ignored when you query the contact.

For info about how to manage contacts, see Contacts and calendar.

For querying purposes, phone numbers support characters 0-9 and a-z/A-Z. If you put any other characters in a phone number, they are ignored when you query the contact.

See also

Applies to

ShowContactCard(Contact, Rect, Placement)

Queries the operating system for a user’s contact and shows the contact data in a contact card.

public:
 static void ShowContactCard(Contact ^ contact, Rect selection, Placement preferredPlacement);
/// [Windows.Foundation.Metadata.Overload("ShowContactCardWithPlacement")]
 static void ShowContactCard(Contact const& contact, Rect const& selection, Placement const& preferredPlacement);
[Windows.Foundation.Metadata.Overload("ShowContactCardWithPlacement")]
public static void ShowContactCard(Contact contact, Rect selection, Placement preferredPlacement);
function showContactCard(contact, selection, preferredPlacement)
Public Shared Sub ShowContactCard (contact As Contact, selection As Rect, preferredPlacement As Placement)

Parameters

contact
Contact

The object that represents the contact that the app wants to display the contact card for.contact must contain at least an Id, Emails, or a phone number from a Phones list to query the user’s contact database to retrieve a matching contact to display. Id has higher priority for querying. If an Id matches, the rest of query parameters will be ignored for matching purposes. If an Id does not find a match, the query uses the rest of query parameters. Emails and Phones have equal priority for matching. If multiple email addresses, or phone numbers, or both are provided, the query first performs an exact match, requiring all query parameters to match a system contact record. If this results in no matches, the query uses "best effort" match, in which a match of any query parameters is sufficient.

If no matches occur, the data in the input contact displays in the contact card. If a match occurs, only system contact data displays, and the data in the input contact is discarded.

selection
Rect

The Rect is the rectangular area of user selection (for example, pressing a button), around which the operating system displays the contact card, not within that rectangular area. For example, if an app uses a button to show the contact card, pass the Rect of the button so the contact card displays around the button, not overlapping it.

preferredPlacement
Placement

The Placement that describes the preferred placement of the contact card.

Attributes

Windows requirements

App capabilities
contactsSystem

Remarks

See the remarks section of this overload: ShowContactCard.

See also

Applies to

ShowContactCard(Contact, Rect, Placement, ContactCardOptions)

Shows a contact card with the specified parameters.

public:
 static void ShowContactCard(Contact ^ contact, Rect selection, Placement preferredPlacement, ContactCardOptions ^ contactCardOptions);
/// [Windows.Foundation.Metadata.Overload("ShowContactCardWithOptions")]
 static void ShowContactCard(Contact const& contact, Rect const& selection, Placement const& preferredPlacement, ContactCardOptions const& contactCardOptions);
[Windows.Foundation.Metadata.Overload("ShowContactCardWithOptions")]
public static void ShowContactCard(Contact contact, Rect selection, Placement preferredPlacement, ContactCardOptions contactCardOptions);
function showContactCard(contact, selection, preferredPlacement, contactCardOptions)
Public Shared Sub ShowContactCard (contact As Contact, selection As Rect, preferredPlacement As Placement, contactCardOptions As ContactCardOptions)

Parameters

contact
Contact

The object that represents the contact that the app wants to display the contact card for.contact must contain at least an Id, Emails, or a phone number from a Phones list to query the user’s contact database to retrieve a matching contact to display. Id has higher priority for querying. If an Id matches, the rest of query parameters will be ignored for matching purposes. If an Id does not find a match, the query uses the rest of query parameters. Emails and Phones have equal priority for matching. If multiple email addresses, or phone numbers, or both are provided, the query first performs an exact match, requiring all query parameters to match a system contact record. If this results in no matches, the query uses "best effort" match, in which a match of any query parameters is sufficient.

If no matches occur, the data in the input contact displays in the contact card. If a match occurs, only system contact data displays, and the data in the input contact is discarded.

selection
Rect

The Rect is the rectangular area of user selection (for example, pressing a button), around which the operating system displays the contact card, not within that rectangular area. For example, if an app uses a button to show the contact card, pass the Rect of the button so the contact card displays around the button, not overlapping it.

preferredPlacement
Placement

The Placement that describes the preferred placement of the contact card.

contactCardOptions
ContactCardOptions

Specifies how to display the contact card, such as which tab to start on when displaying a mini contact card.

Attributes

Windows requirements

App capabilities
contactsSystem

Remarks

See the remarks section of this overload: ShowContactCard.

See also

Applies to