Share this page 

Use the default MAPI profileTag(s): WinAPI/Registry


// Win NT
MailSession lms_mSes

lms_mSes = CREATE MailSession
li_rc = RegistryGet( &
  "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\" &
  + "CurrentVersion\Windows Messaging Subsystem\Profiles" , &
  "DefaultProfile", RegString!, ls_profile )
  // Win9x,
  // "HKCU\Software\Microsoft\Windows Messaging Subsystem\Profiles"

IF li_rc = FAILURE THEN
    // no registry entries for default MAPI profile
    RETURN -1
END IF
lms_mSes.MailLogon(ls_profile, "", mailNewSession!)

Calling the MailLogon change the current directory so it's a good idea to keep the current directory before making the call and restore it after.

Using the PFC, this should like this :

n_cst_filesrv lnv_fsrv

f_SetFileSrv(lnv_fsrv, TRUE)
ls_path = lnv_fsrv.of_GetCurrentDirectory()

// MAPI stuff

lnv_fsrv.of_ChangeDirectory(ls_path)
f_SetFileSrv(lnv_fsrv, FALSE)