EntryID Property

Microsoft Outlook Visual Basic

Show All

EntryID Property

       

Returns a String representing the unique entry ID of the object. This property corresponds to the MAPI property PR_ENTRYID. MAPI systems assign a permanent, unique ID string when an object is created that does not change from one MAPI session to another. The EntryID property is not set for an Outlook item until it is saved or sent. Also, the EntryID changes when an item is moved into another folder. Read-only.

expression.EntryID

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

Example

This Visual Basic for Applications example uses the EntryID property to compare the entry ID of one message to the entry ID of a message returned by a search operation to determine whether the objects represent the same message.

Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myContacts = myNameSpace.GetDefaultFolder(olFolderContacts)
Set myItem1 = myOlApp.CreateItem(olContactItem)
myItem1.FirstName = "Brent"
Set myitem2 = myContacts.Items.Find("[FileAs] = ""Jones"" and [FirstName] = ""Brent""")
If Not TypeName(myitem2) = "Nothing" Then
    If myItem1.EntryID = myitem2.EntryID Then
       MsgBox "These two message objects refer to the same message."
    End If
Else
    MsgBox "The contact items were not found."
End If