Skip to Content
CDO & MAPI Programming with Visual Basic:
book

CDO & MAPI Programming with Visual Basic:

by Dave Grundgeiger
October 2000
Intermediate to advanced
384 pages
10h 22m
English
O'Reilly Media, Inc.
Content preview from CDO & MAPI Programming with Visual Basic:

Showing the Address Book

If you’re writing an application that allows the user to enter recipients for an outgoing message, it’s convenient for the user to have a way to display the address book and to select recipients directly from it. In Simple MAPI, this is done using a combination of two functions: BMAPIAddress and BMAPIGetAddress. BMAPIAddress displays the address book and records the user’s selections (internally), returning a handle to the selections through an out parameter. BMAPIGetAddress accepts the handle as input and returns (again through an out parameter) an array of MapiRecip records representing the address entries selected from the address book. This array can then be passed to the MAPISendMail function. Example 3-5 demonstrates this process. Figure 3-4 shows the address book dialog box displayed by the MAPI system when BMAPIAddress is called.

Example 3-5. Showing the Address Book

' Assume that a MAPI session has already been established, and that ' nMAPISession holds the session handle. Dim nRetVal As Long Dim MyMessage As MAPIMessage Dim MyRecips( ) As MapiRecip Dim MyFiles( ) As MapiFile Dim nInfo As Long Dim nRecipients As Long ' Set the subject and body text of the message. MyMessage.Subject = "Test message from Simple MAPI." MyMessage.NoteText = "This is the body text of the message." ' Show the address book to allow the user to select recipients. nRetVal = BMAPIAddress(nInfo, nMAPISession, 0, "Select Names", 4, "", _ nRecipients, MyRecips, 0, 0) If ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Excel® 2007 VBA Programmer's Reference

Excel® 2007 VBA Programmer's Reference

John Green, Stephen Bullen, Rob Bovey, Michael Alexander
COM Programming with Microsoft® .NET

COM Programming with Microsoft® .NET

John Paul Mueller, Julian Templeman

Publisher Resources

ISBN: 156592665XSupplemental ContentCatalog PageErrata