The following illustration summarizes how to access the data exported to a callback function using the BatchExport function.
Exporting data into struct arrays
If the user has specified that data is to be exported as a value array (by setting ulEvalTag in the EXPORT_CALLBACK structure to VALUE_ARRAY), each attribute is exported as an appropriate data type. Each attribute is described by an ATT_VALUE structure. This structure contains a member variable called DapiType, which indicates the type of the exported value, and a union called Value, which contains the actual data.
The following code shows how DapiType is used to find the data type, and how the Value union is then referenced to access the data.
PATT_VALUE pAttValue = &pExportEntry->rgEntryValues[index];
switch (pAttValue->DapiType)
{
case DAPI_STRING8:
printf("%s\n", pAttValue->Value.pszA);
break;
case DAPI_UNICODE:
printf("%S\n", pAttValue->Value.pszW);
break;
case DAPI_BINARY:
printf("Binary data at %08lx\n", pAttValue->Value.lpBinary);
break;
case DAPI_INT:
printf("%d\n", pAttValue->Value.iValue);
break;
case DAPI_BOOL:
printf("%s\n", pAttValue->Value.bool ? "True" : "False");
break;
default:
printf("Invalid DapiType: %d\n", pAttValue->DapiType);
break;
}
In the preceding code example, index specifies which ATT_VALUE structure element in the array to read. For another example, see the DIRSYNC sample application file in the \BKOFFICE\SAMPLES\EXCHANGE directory.