편집

다음을 통해 공유


NameSpace.GetRecipientFromID method (Outlook)

Returns the Recipient object that is 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 to ease the transition between MAPI and OLE/Messaging applications and Microsoft Outlook.

This method is similar to the GetRecipientFromID method of the Account object. If there are multiple Microsoft Exchange accounts in the current profile, use the GetRecipientFromID method for the corresponding account.

Example

This Visual Basic for Applications (VBA) example gets the entry ID of the first recipient for the first item in the Items collection for the Inbox folder, uses GetRecipientFromID to obtain the recipient from the entry ID, and displays the recipient name.

Public Sub GetRecipientFromID() 
 
 Dim inbox As Outlook.folder 
 
 Dim mail As Outlook.MailItem 
 
 Dim rcp As Outlook.Recipient 
 
 Dim rcp1 As Outlook.Recipient 
 
 Dim strEntryId As String 
 
 
 
 'Get Inbox folder. 
 
 Set inbox = Application.session.GetDefaultFolder(olFolderInbox) 
 
 
 
 ' Get the first item in the Inbox. 
 
 Set mail = inbox.items(1) 
 
 
 
 ' Get the first recipient on that first item. 
 
 Set rcp = mail.Recipients.Item(1) 
 
 
 
 ' Get the string entry ID of the recipient. 
 
 strEntryId = rcp.entryID 
 
 
 
 ' Get the Recipient object based on the string entry ID. 
 
 Set rcp1 = Application.session.GetRecipientFromID(strEntryId) 
 
 
 
 MsgBox "Recipient Name: " & rcp1.name, vbInformation 
 
End Sub

See also

NameSpace Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.