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

返回一个字符串, 表示对象的唯一条目 ID。Returns a String representing the unique Entry ID of the object. 此为只读属性。Read-only.


expressionexpression. EntryID

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


此属性对应于 MAPI 属性PidTagEntryIdThis property corresponds to the MAPI property PidTagEntryId.

MAPI 存储提供程序将在存储中创建项时分配的唯一 ID 字符串。A MAPI store provider assigns a unique ID string when an item is created in its store. 因此, 在保存或发送 Outlook 项目之前, 不会为该项目设置EntryID属性。Therefore, the EntryID property is not set for an Outlook item until it is saved or sent. 条目 ID 更改时将项目移动到另一个存储中,例如,从 Microsoft Exchange Server 的公用文件夹,您 的收件箱或从一个到另一个.pst 文件的个人文件夹 (.pst) 文件。The Entry ID changes when an item is moved into another store, for example, from your Inbox to a Microsoft Exchange Server public folder, or from one Personal Folders (.pst) file to another .pst file. 解决方案不应依赖于 EntryID 属性来保持唯一性,除非不移动项目。Solutions should not depend on the EntryID property to be unique unless items will not be moved. EntryID 属性返回一个 MAPI 长期条目 id。The EntryID property returns a MAPI long-term Entry ID. 有关长时间和短期条目id 的详细信息, 请搜索 PidTagEntryIdFor more information about long- and short-term EntryIDs, search for PidTagEntryId.


本 Visual Basic for Applications (VBA) 示例使用EntryID属性将一个联系人的条目 id 与搜索操作所返回的联系人的条目 id 进行比较, 以确定这些对象是否代表同一联系人。This Visual Basic for Applications (VBA) example uses the EntryID property to compare the Entry ID of one contact to the Entry ID of a contact returned by a search operation to determine whether the objects represent the same contact. 运行此示例之前在您联系人文件夹中的有效联系人姓名替换名称。Replace the name with a valid contact name in your Contacts folder before running this example.

Sub UseEntryID() 
 Dim myNamespace As Outlook.NameSpace 
 Dim myContacts As Outlook.Folder 
 Dim myItem1 As Outlook.ContactItem 
 Dim myItem2 As Outlook.ContactItem 
 Set myNameSpace = Application.GetNamespace("MAPI") 
 Set myContacts = myNameSpace.GetDefaultFolder(olFolderContacts) 
 Set myItem1 = myContacts.Items.Find("[FirstName] = ""Dan""") 
 Set myitem2 = myContacts.Items.Find("[FileAs] = ""Wil"" and [FirstName] = ""Dan""") 
 If Not TypeName(myitem2) = "Nothing" Then 
 If myItem1.EntryID = myitem2.EntryID Then 
 MsgBox "These two contact items refer to the same contact." 
 End If 
 MsgBox "The contact items were 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.