Certain directory access functions let you use callback functions, which provide added control. For example, an application can receive exported data directly instead of having the data exported to a file on the disk. To do this, the application specifies an export callback function when the BatchExport function is called. When the BatchExport function executes, it calls the callback function once for each entry it exports, passing it a pointer to the exported data. This functionality lets you use the BatchExport function for line-by-line exporting.
The three different kinds of callback functions are specified in the parameters passed in calls to export functions. For example, the BatchExport function takes one parameter, lpBexportParms (a pointer to a BEXPORT_PARMS structure), which contains parameters for directory export operations. BEXPORT_PARMS contains all three fields used to specify callback functions. If the pointer to the callback structure is left NULL, default behavior — described for each callback in this list — is invoked.
The NTExport and NWExport functions are used to export user accounts from Windows NT and Novell NetWare Servers respectively, so that that this data can later be imported into a Microsoft Exchange Server directory. These two functions are called in order with the NTEXPORT_PARMS and NWEXPORT_PARMS structures acting as parameters. These structures in turn contain the ProgressCallBacks and ErrorCallback members, as well as the ExportCallback member, which is used to point to an export callback function.
Callbacks can also be used when importing data. The BIMPORT_PARMS structure (which contains the ProgressCallBacks and ErrorCallback members) is used as a parameter for the BatchImport function. In this case, the appropriate functions specified in ProgressCallBacks are called each time a line is imported from the import file.