Platform SDK: Exchange Server

Installing an Admin-Extension Object

If your application is to present data to administrators on custom property pages, its setup program should install this functionality. This means installing the Admin-Extension object in the directory and copying the Administrator extension DLL and any other necessary files to specific disk locations. For information about copying files, see Copying Files Onto Disk.

For each Admin-Extension object to be installed, perform the following steps.

To install an Admin-Extension object

  1. Verify whether the Admin-Extension object already exists in the directory, using MAPI functions or the BatchExport function. See Finding an Object in the Directory.
  2. If the Admin-Extension object does exist, check its version. This is a multistep procedure that uses calls to the HrGetFileVersionInfo, VerQueryValue, HrAdminExtensionExists, and HrGetAdminExtensionVersion functions. If no Admin-Extension object by this name exists in the directory, skip to step 4.
  3. If the installed Admin-Extension object is newer than the one to be installed, use a dialog box to require the administrator to choose whether to overwrite the installed Admin-Extension object with the older one on the distribution medium. If the user answers No, end the installation of this Admin-Extension object; if other Admin-Extension objects are to be installed, begin their installation at step 1.
  4. Call the Win32 CoCreateGuid function to create a GUID. Convert this GUID into a string, and then use that string as a unique extension name for the Admin-Extension object. This is accomplished in the following sample code:
    CoCreateGuid(&guid);
    
    sprintf(
        szGatewayName,
        "%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
        guid.Data1,
        guid.Data2,
        guid.Data3,
        guid.Data4[0],guid.Data4[1],guid.Data4[2],guid.Data4[3],
        guid.Data4[4],guid.Data4[5],guid.Data4[6],guid.Data4[7]);
     
  5. If an Admin-Extension object with the same name as the one you are installing already exists, remove the installed object by calling the HrRemoveAdminExtension function, and passing the extension name of the Admin-Extension object.
  6. Copy the files associated with the Admin-Extension object to the server computer. See Files Used with Directory Objects.
  7. Create the new Admin-Extension object in the directory with the BatchImport or DAPIWrite function. Use the GUID created in step 4 for the extension name of the object.

For general information about working with Administrator extensions, see Administrator Program Extensions. For information about setting the attribute values of the Extension-Data attribute, see Initializing the Extension-Data Attribute.