Installing Forms into the Organization Forms Library

Administrators usually install new forms into the organization forms library if users throughout the organization need access. You can also install forms into this library programmatically, subject to the access rights under which your program is running.

    To install a form into the organization forms library
  1. Obtain a MAPI session. Do this by initializing MAPI with the MAPIInitialize function and logging on to a MAPI profile with the MAPILogonEx function. For more information, see the first steps of Opening an Information Store. To install forms, this MAPI profile needs Create permission on the organization forms library.
  2. Open the MAPI form manager interface by calling the MAPIOpenFormMgr function and passing a pointer to the MAPI LPMAPISESSION session. This call opens an IMAPIFormMgr interface on a forms-library provider object.
  3. Open the organization forms library by calling the MAPI IMAPIFormMgr::OpenFormContainer method . Pass the HFRMREG_ENTERPRISE constant for the hfrmreg parameter. This denotes the organization's Microsoft Exchange Server library in the public information store.

    When IMAPIFormMgr::OpenFormContainer detects HFRMREG_ENTERPRISE, it returns an interface pointer to the organization forms library. You can then call any of the MAPI-defined forms container methods.

  4. Install the form with a call to the IMAPIFormContainer::InstallForm function, passing a pointer to the name of the configuration file for the form.

The INSTFORM.EXE sample application is a command-line utility that installs or removes a Microsoft Exchange Server form. You can run it to study the installation of forms, and you can look at its source files (in particular INSTFORM.CPP), which are located in the \BKOFFICE\SAMPLES\EXCHANGE\INSTFORM directory. Some of the code from INSTFORM.CPP is reproduced here:

hr = MAPILogonEx( 
        NULL, lpszProfile, lpszPassword, 
        MAPI_LOGON_UI|MAPI_EXTENDED|MAPI_NEW_SESSION, 
        &lpMAPISession);

// Open form manager interface.
hr = MAPIOpenFormMgr( lpMAPISession, &lpFormMgr);

// Open appropriate form container.
hr = lpFormMgr->OpenFormContainer( hFrmReg, lpFolder, &lpFormContainer);

hr = lpFormContainer->InstallForm( NULL, ulUIFlags, UserParams.m_pszCfgFile);
 

For more information about MAPI form libraries, see the MAPI Programmer's Reference.