![]() |
|
||||
CFGCODEThe CFGCODE sample is related to HrCfgPackData and HrCfgUnpackData. You may use it to prepare a data file from an easy to understand INI file as explained below, and then use the HrCfgUnpackData to obtain a regular collection of MAPI properties. Contrary to Address Book and Message Store Viewers the CFGCODE is not ready to use. You need to build it. The source is located under Mssdk\samples\dbmsg\exchange\cfgcode. One interesting feature (a bug) of it is that it can't be built if the root directory is renamed from default Mssdk to something else. Once you have the CFGCODE sample compiled you can exercise it with the following command: CFGCODE /? It would be a good idea to read the MSDN Library article named "CFGCODE:
Generated a Packed Property Structure" where Microsoft explains some of
its features.
Input File Format for CFGCODECFGCODE works only with 5 property types: PT_LONG, PT_BOOLEAN, PT_SYSTIME, PT_STRING8 and PT_BINARY. This means that you can't use it for conversion of multivalued properties such as string arrays. However, you can define sections in the input file and specify section name as one of the parameters to the program. This will convert only properties defined under this section and ignore all other sections. Here is the sample INI file:;
[MySection]
[AnotherSection]
Usage of CFGCODEIf you execute CFGCODE /? command you would normally see the following self explanatory screen:Utility to create a packed configuration data from a .INI file. USAGE: CFGCODE InFile OutFile [Flags] InFile
Input .INI file containing MAPI properties
The following command: CFGCODE MyInput.INI MyOutput.DAT /SECTION=MySection /NAME=MyName will pack MAPI properties from MySection of your MyInput.INI file into
MyOutput.DAT file. You may wish to examine its contents with a binary editor
in order to see how properties are packed. Although it may seem that section
and name flags are optional, in fact they are not. The CFGCODE program
is also able to log errors to Windows NT application log. When I executed
the program against a non existing .INI file it logged an event describing
the error condition.
|