Microsoft KB Archive/176337

= FILE: Profsamp.exe: How to Manipulate MAPI Profiles Sample =

ID: Q176337

The information in this article applies to:


 * Extended Messaging Application Programming Interface (MAPI), version 1.0

SUMMARY
This sample demonstrates how to accomplish some of the most common profile -related operations.

The sample was written with Microsoft Visual C++ and Microsoft Foundation Classes (MFC).

The following file is available for download from the Microsoft Software Library:

~ Profsamp.exe (size: 112897 bytes) For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:

ARTICLE-ID: Q119591 TITLE    : How to Obtain Microsoft Support Files from Online Services

MORE INFORMATION
The sample, Profman, was created to demonstrate how to use the MAPI interfaces and methods that pertain to the manipulation and creation of MAPI profile. Here is a list of the functionality:


 * Create a new blank profile.
 * Add services to a profile.
 * Delete services from a profile.
 * List the services in a profile.
 * Add providers to a service.
 * Delete providers from a service.
 * List the providers in a service.
 * Set the default store provider of a service.
 * List the available properties of a provider.

Source Files

 * ServiceDlg.cpp: Contains the code for the user interface of the dialog box that displays the services installed in a particular profile.
 * ServiceObj.cpp: Contains the code that manages the data used by ServiceDlg.cpp.
 * ProviderDlg.cpp: Contains the code for the user interface of the dialog box that displays the providers of a particular service.
 * ProviderObj.cpp: Contains the code that manages the data used by ProviderDlg.cpp.
 * ProvPropsDlg.cpp: Contains the code for the user interface of the dialog box that displays the properties of a particular provider.
 * ProvPropsObj.cpp: contains the code that manages the data used by ProvPropsObj.cpp.
 * SelectService.cpp: Contains the code for the user interface and data that displays all available services installed on the system and allows the user to select one to be installed.
 * SelectProvider.cpp: Contains the code for the user interface and data that displays all available providers for the selected service and allows the user to select one to be installed.
 * ProfileNameDlg.cpp: Contains the code for the user interface and data that displays a simple dialog box to allow the user to enter the name of a profile to be created.
 * StdAfx.cpp: Source file that contains just the standard includes.
 * ProfMan.cpp: Defines the class behaviors for the application.

Header Files

 * ServiceDlg.h
 * ServiceObj.h
 * ProviderDlg.h
 * ProviderObj.h
 * ProvPropsDlg.h
 * ProvPropsObj.h
 * SelectService.h
 * SelectProvider.h
 * ProfileNameDlg.h
 * ProfManDlg.h
 * StdAfx.h
 * ProfMan.h
 * Resource.h

Resource Files

 * ProfMan.ico
 * ProfMan.rc

Project Files

 * Profman.dsw: Microsoft Developer Studio Workspace
 * Profman.dsp: Microsoft VC++ Project file

SETUP
Follow these steps to build the sample:

1. Extract the files from the self-extracting executable file,

Profsamp.exe. 2. Open a command prompt in the folder where you extracted the files.

3. To create the sample type the following command:

nmake profman.mak

This creates a .\Debug directory and places the built executable into the directory.

Running the Sample
There are two main dialog boxes that you see when you run this sample application:

1. Main Dialog Box (titled Profile Manager):

- The New button allows you to create a new profile. This newly created profile will be blank (no service providers installed). You will be prompted to enter a name for the new profile.

- The Open button allows you to open a different profile. This closes your currently loaded profile.

- The Get Providers button brings up a dialog box titled Providers. This dialog box displays all of the providers installed for the currently selected service. For instructions on how to use this dialog, see step 2 below.

- The Add Service button brings up a dialog box titled Add Service. This dialog box presents you with a list of available MAPI Service providers on your system. You can select one of them to install. When you select a service to be installed, the service may prompt you for more information.

- The Delete Service button will delete the currently selected service from your profile. 2. Provider Dialog Box (titled Providers):

This dialog box lists all of the providers of the service that were selected on the mail dialog box:

- The Get Properties button displays some of the properties of     the selected provider. Many of the providers properties are not exposed to MAPI clients so ProfMan is unable to display them.

- The Add Provider button brings up a dialog box that lists all of the providers of the current service. The user can now select one of the providers to install.

- The Delete Provider button removes the currently selected provider.

- The SetDefaultStore button attempts to set the currently selected provider as the default store for the provider. If this call fails, the selected provider can not be made the default store. Additional query words: MAPI Profile Service Provider

Keywords         : kbMsg kbMAPI100 Version          : WINDOWS:1.0 Platform         : WINDOWS Issue type       : kbinfo Last Reviewed: November 21, 1997