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
-
Open the directory object. See Finding an Object in the Directory and Using MAPI with Directory Objects.
-
Read the data with an array of SPropValue structures using the IMAPIProps::GetProps method.
-
Use MAPI methods to locate the property in the array of SPropValue structures.
-
Manipulate strings and other types of data using standard C functions.
To read extension data using MAPI
-
Open the directory object that contains the extension data. See Finding an Object in the Directory and Using MAPI with Directory Objects.
-
Call IMAPIProps::GetProps to read the extension data attribute into a buffer.
-
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
-
Express the data in a MAPI SPropValue array.
-
Write the data using the IMAPIProps::SetProps method.
To write extension data
-
Express the data in an array of SPropValue structures.
-
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.
-
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.