Export (0) Print
Expand All

NameSpace.GetRecipientFromID Method

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



expression   A variable that represents a NameSpace object.


NameRequired/OptionalData TypeDescription
EntryIDRequiredStringThe EntryID of the recipient.

Return Value
A Recipient object that represents the specified recipient.


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


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

Community Additions

© 2014 Microsoft