This topic has not yet been rated - Rate this topic

NameSpace.CreateContactCard Method (Outlook)

Published: July 16, 2012

Creates an instance of a ContactCard object for the contact that is specified by the AddressEntry parameter.

Version Added: Outlook 2010

expression .CreateContactCard(Address)

expression A variable that represents a NameSpace object.

Parameters

Name

Required/Optional

Data Type

Description

AddressEntry

Required

AddressEntry

The AddressEntry object that represents the user for whom the contact card is to be created.

Return Value

The Office.ContactCard object that is created for the specified user.

The ContactCard object is available in the type library of Microsoft Office. Before calling CreateContactCard to create a contact card in Microsoft Outlook, Outlook must be logged into an Outlook session.

The AddressEntry parameter is an AddressEntry object that represents one of the following AddressEntry types defined in the OlAddressEntryUserType enumeration:

  • olExchangeDistributionListAddressEntry

  • olExchangeRemoteUserAddressEntry

  • olExchangeUserAddressEntry

  • olOutlookContactAddressEntry

  • olSmtpAddressEntry

Outlook raises the E_INVALIDARG error when you pass any of the following OlAddressEntryUserType values as an argument to the CreateContactCard method:

  • olExchangeAgentAddressEntry

  • olExchangeOrganizationAddressEntry

  • olExchangePublicFolderAddressEntry

  • olLdapAddressEntry

  • olOtherAddressEntry

  • olOutlookDistributionListAddressEntry

The following code sample in Microsoft Visual Basic for Applications (VBA) displays a Contact Card for the current user defined by the CurrentUser property of the NameSpace object.

You cannot run this code directly from the VBA window. To run the code, click the Developer tab, click the Macros menu, and then select Project1.DisplayContactCardForCurrentUser. For more information about the Developer tab, see Run in Developer Mode in Outlook.

Sub DisplayContactCardForCurrentUser() 
 
 Dim oCC As Office.ContactCard 
 
 Dim oAddrEntry As Outlook.AddressEntry 
 
 Set oAddrEntry = Application.session.CurrentUser.AddressEntry 
 
 Set oCC = Application.session.CreateContactCard(oAddrEntry) 
 
 oCC.Show msoContactCardFull, 100, 100, 100, 100, 100, True 
 
 End Sub 
 

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.