EntryID Property
This documentation is archived and is not being maintained.

EntryID Property

Office 2003

Returns a String representing the unique entry ID of the object. This property corresponds to the MAPI property PR_ENTRYID. Read-only.


expression     Required. An expression that returns one of the objects in the Applies To list.


A MAPI store provider assigns a unique ID string when an item is created in its store. Therefore, the EntryID property is not set for a Microsoft Outlook item until it is saved or sent. The EntryID 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. Solutions should not depend on the EntryID property to be unique unless items will not be moved. The EntryID property returns a MAPI long-term EntryID. For more information about long- and short-term EntryIDs, search http://msdn.microsoft.com for PR_ENTRYID.


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 myOlApp As Outlook.Application
	Dim myNamespace As Outlook.NameSpace
	Dim myContacts As Outlook.MAPIFolder
	Dim myItem1 As Outlook.ContactItem
	Dim myItem2 As Outlook.ContactItem
	Set myOlApp = CreateObject("Outlook.Application")
	Set myNameSpace = myOlApp.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


© 2016 Microsoft