NameSpace.CreateContactCard 方法 (Outlook)

AddressEntry 参数指定的联系人创建 ContactCard 对象的实例。

语法

expressionCreateContactCard( _Address_ )

表达 一个代表“NameSpace”对象的变量。

参数

名称 必需/可选 数据类型 说明
AddressEntry 必需 AddressEntry 表示要创建的联系人卡片所对应的用户的 AddressEntry 对象。

返回值

为指定用户创建 Office.ContactCard 对象。

备注

Microsoft Office 类型库中提供了 ContactCard 对象。 在调用之前 CreateContactCard 在Microsoft Outlook中创建联系人卡片,Outlook 必须登录到 Outlook 会话中。

AddressEntry 参数是一个 AddressEntry 对象,它表示在 OlAddressEntryUserType 枚举中定义的以下 AddressEntry 类型之一:

  • olExchangeDistributionListAddressEntry

  • olExchangeRemoteUserAddressEntry

  • olExchangeUserAddressEntry

  • olOutlookContactAddressEntry

  • olSmtpAddressEntry

当您下面的 OlAddressEntryUserType 值的任何作为参数传递给 CreateContactCard 方法时,outlook 会引发 E_INVALIDARG 错误:

  • olExchangeAgentAddressEntry

  • olExchangeOrganizationAddressEntry

  • olExchangePublicFolderAddressEntry

  • olLdapAddressEntry

  • olOtherAddressEntry

  • olOutlookDistributionListAddressEntry

示例

下面的 Microsoft Visual Basic for Applications (VBA) 代码实例显示由 NameSpace 对象的 CurrentUser 属性定义的当前用户的联系人卡片。

不可直接从 VBA 窗口运行此代码。 若要运行这段代码,单击“开发工具”选项卡,单击“宏”菜单,然后选择“Project1.DisplayContactCardForCurrentUser”。 有关“开发工具”选项卡的详细信息,请参阅在 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

另请参阅

命名空间对象

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。