Hi there, I'm trying to figure out how to use mapi to do an xquery. I have been able to shred documents (using MIL), but mapi with xquery is giving me trouble. Looking at the implementation of MapiClient, I see the following piece of code which appears relevant: /* xquery options are passed via the command string (becomes first line of query) */ char *c = command ? command : XQuerydefaultMode; char *t = strstr(c, "timing-") ? "" : mark ? "timing-" : ""; char *d = strstr(c, "debug-") ? "" : trace ? "debug-" : ""; char *m = strstr(c, "-mapi") ? "" : "-mapi"; command = (char*) malloc(strlen(c) + 20); sprintf(command, "%s%s%s%s\n", t, d, c, m); as well as this code: if (command) { /* special code for XQuery: prepend command to query */ hdl = mapi_query_prep(mid); CHECK_RESULT(mid, hdl, buf, break); mapi_query_part(hdl, command, strlen(command)); what exactly is going on here? The logic is rather opaque... Is there some minimal code example somewhere out there that shows how to do an xquery using mapi? Regards, Martijn