Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Tue, 12 Dec 2006 23:03:44 +0100,    group: microsoft.public.platformsdk.messaging        back       


HOWTO: Programming custom forms: Create recipient list and send the form   
When programming a custom form e.g. in VC++ and the form should be sent 
using a send button then often a button to create the recipient list is also 
needed. Here is a short description how to implement these two features.

1. Creating a recipient list
- Call IMAPISession::OpenAddressBook. The IMAPISession pointer can be 
retrieved in the MAPI form itself using the function 
IMAPIMessageSite::GetSession. The pointer to IMAPIMessageSite is passed to 
our MAPI form in IPersistMessage::Load or IPersistMessage::InitNew. To 
IMAPISession::OpenAddressBook just pass the form's HWND and you'll receive 
an LPADRBOOK pointer (IAddrBook).
- Then call IAddrBook::Address to display the address chooser dialog. It 
requires an HWND and a big structure with all the properties of how to show 
the dialog. One thing to mention there: cDestFields may be set to e.g. 2, 
even if lpulDestComps is NULL. It returns an LPADRLIST pointer containing 
all the recipients. The return code is MAPI_E_USER_CANCEL if the user has 
pressed cancel in that dialog.
- To display the list of selected users in an edit box, loop through all 
entries of the returned address list. For every entry loop through all 
properties. The properties PR_DISPLAY_NAME and PR_RECIPIENT_TYPE are of 
importance. The latter one is set to MAPI_TO or MAPI_CC for the two most 
important fields.
- If the edit box is editable, then manually resolve the name there. More 
information in Q266351 / KB266351 (see 
http://support.microsoft.com/kb/266351/).

2. To send the form
- Make sure the form contains a recipient list.
- Assign the recipient list to the message using the function 
IMessage::ModifyRecipients. The message pointer is received in our MAPI form 
through IPersistMessage::Load or IPersistMessage::InitNew.
- Call IMAPIMessageSite::SubmitMessage. The pointer to IMAPIMessageSite is 
passed to our MAPI form in IPersistMessage::Load or 
IPersistMessage::InitNew.
- Close the form if successfully sent in the same way like if the user 
pressed Cancel. See also example Q246524 / KB246524 called MyFormServer 
(http://support.microsoft.com/kb/246524) created with VC++ 6.0. This sample 
implements a simple custom form, but doesn't support sending or address 
lists.

Eric Bauersachs
date: Tue, 12 Dec 2006 23:03:44 +0100   author:   Eric

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us