ContactItem 属性 (Outlook)ContactItem.UserProperties property (Outlook)

返回**UserProperties** 集合, 该集合代表 Outlook 项目的所有用户属性。Returns the UserProperties collection that represents all the user properties for the Outlook item. 此为只读属性。Read-only.

语法Syntax

expressionexpression. UserProperties

_表达式_一个代表ContactItem对象的变量。expression A variable that represents a ContactItem object.

示例Example

本 Visual Basic for Applications (VBA) 示例找到并向用户显示联系人"Jeff Smith"的名为 LastDateContacted 的自定义属性。This Visual Basic for Applications (VBA) example finds a custom property named LastDateContacted for the contact 'Jeff Smith' and displays it to the user. 要运行此示例,需将"Jeff Smith"替换为一个有效的联系人姓名,并为该联系人创建一个称作 LastDateContacted 的用户定义属性。To run this example, you need to replace 'Jeff Smith' with a valid contact name and create a user-defined property called LastDateContacted for the contact.

Sub FindContact() 
 
 'Finds and displays last contacted info for a contact 
 
 
 
 Dim objContact As Outlook.ContactItem 
 
 Dim objContacts As Outlook.Folder 
 
 Dim objNameSpace As Outlook.NameSpace 
 
 Dim objProperty As Outlook.UserProperty 
 
 
 
 Set objNameSpace = Application.GetNamespace("MAPI") 
 
 Set objContacts = objNameSpace.GetDefaultFolder(olFolderContacts) 
 
 Set objContact = objContacts.Items.Find( _ 
 
 "[FileAs] = ""Smith, Jeff"" and [FirstName] = ""Jeff""") 
 
 If Not TypeName(objContact) = "Nothing" Then 
 
 Set objProperty = _ 
 
 objContact.UserProperties.Find("LastDateContacted") 
 
 If TypeName(objProperty) <> "Nothing" Then 
 
 MsgBox "Last Date Contacted: " & objProperty.Value 
 
 End If 
 
 Else 
 
 MsgBox "The contact was not found." 
 
 End If 
 
End Sub

另请参阅See also

创建 ContactItem 对象ContactItem Object

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.