NameSpace.GetRecipientFromID Method

Outlook Developer Reference

Returns a Recipient object identified by the specified entry ID (if valid).

Syntax

expression.GetRecipientFromID(EntryID)

expression   A variable that represents a NameSpace object.

Parameters

Name Required/Optional Data Type Description
EntryID Required String The EntryID of the recipient.

Return Value
A Recipient object that represents the specified recipient.

Remarks

This method is used for ease of transition between MAPI and OLE/Messaging applications and Microsoft Outlook.

Example

This Visual Basic for Applications (VBA) example gets the entry ID of the first recipient in the item in the Inbox folder with subject 'Test', obtains the recipient from the entry ID, and displays the recipient name. To run this example without any errors, make sure there is a mail item with subject 'Test' in the Inbox. The example may also fail if there are other types of items with subject 'Test' other than mail item in the Inbox.

Visual Basic for Applications
  Public Sub GetFromID()
	Dim nsp As Outlook.NameSpace
	Dim mpfInbox As Outlook.Folder
	Dim mail As Outlook.MailItem
	Dim rcp As Outlook.Recipient
	Dim rcp1 As Outlook.Recipient
	Dim strEntryId As String
	Set nsp = Application.GetNamespace("MAPI")
	Set mpfInbox = nsp.GetDefaultFolder(olFolderInbox)
	Set mail = mpfInbox.Items("Test")
	Set rcp = mail.Recipients.Item(1)
	strEntryId = rcp.EntryID
	Set rcp1 = nsp.GetRecipientFromID(strEntryId)
	MsgBox rcp1.Name
End Sub

See Also