Platform SDK: Exchange Server

Storing and Accessing Configuration Information

Configuration information for a service object (a Mailbox-Agent or Mail-Gateway) is stored in the server-application object in the directory. Configuration information for recipients is stored in Mailbox objects in the directory. Both types can be accessed through the Microsoft Exchange Server Address Book provider.

The mechanisms for programmatically reading and writing standard configuration data and extension data are similar, but not identical.

To read standard configuration data using MAPI

  1. Open the directory object. See Finding an Object in the Directory.
  2. Read the data with an array of SPropValue structures using the IMAPIProps::GetProps method.
  3. Use MAPI methods to locate the property in the array of SPropValue structures.
  4. Manipulate strings and other types of data using standard C functions.

To read extension data using MAPI

  1. Open the directory object that contains the extension data. See Finding an Object in the Directory.
  2. Call IMAPIProps::GetProps to read the extension data attribute into a buffer.
  3. Unpack the extension data attribute using the HrCfgUnpackData function. This gives you the array of SPropValue structures, which you can read using standard C functions to manipulate strings and other types of data.

Configuration data is written when an administrator is editing property pages through the Administrator program and clicks the Apply Now or OK button. The following steps describe how to set up this action.

To write standard configuration data

  1. Express the data in a MAPI SPropValue array.
  2. Write the data using the IMAPIProps::SetProps method.

To write extension data

  1. Express the data in an array of SPropValue structures.
  2. Pack the extension data into a binary value using the HrCfgPackData function. When the extension data attribute is written into a memory buffer, it is still in packed (binary) form.
  3. Write the data using the SetObjectData function.

Note  For reading and writing very large individual attributes, it may be better to use the IStream interface than to use IMAPIProps::SetProps and IMAPIProps::GetProps. For more information, see Getting and Setting Properties Efficiently and Minimizing IStream Interface Use.