NameSpace.CreateRecipient method (Outlook)
Creates a Recipient object.
expression A variable that represents a NameSpace object.
|RecipientName||Required||String||The name of the recipient; it can be a string representing the display name, the alias, or the full SMTP email address of the recipient.|
A Recipient object that represents the new recipient.
This method is most commonly used to create a Recipient object for use with the GetSharedDefaultFolder method, for example, to open a delegator's folder. It can also be used to verify a given name against an address book.
This Visual Basic for Applications (VBA) example uses the GetSharedDefaultFolder method to resolve the Recipient object representing Dan Wilson, and then returns Dan's shared default Calendar folder. To run this example, replace 'Dan Wilson' with a valid recipient name and make sure the calendar is shared and you have permissions to view the calendar.
Sub ResolveName() Dim myNamespace As Outlook.NameSpace Dim myRecipient As Outlook.Recipient Dim CalendarFolder As Outlook.Folder Set myNamespace = Application.GetNamespace("MAPI") Set myRecipient = myNamespace.CreateRecipient("Dan Wilson") myRecipient.Resolve If myRecipient.Resolved Then Call ShowCalendar(myNamespace, myRecipient) End If End Sub Sub ShowCalendar(myNamespace, myRecipient) Dim CalendarFolder As Folder Set CalendarFolder = _ myNamespace.GetSharedDefaultFolder _ (myRecipient, olFolderCalendar) CalendarFolder.Display End Sub
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.