This example shows how to fetch an appointment from the server.This is very similar to the fetchmail.c example, except two minor changes:
#define DEFAULT_PROFDB "%s/.openchange/profiles.ldb"
int main(int argc, char *argv[])
{
enum MAPISTATUS retval;
struct mapi_SPropValue_array props_all;
struct SRowSet rowset;
struct SPropTagArray *SPropTagArray;
char *profname;
char *profdb;
uint32_t Numerator;
uint32_t Denominator;
uint32_t i;
mem_ctx = talloc_named(NULL, 0, "fetchappointment");
profdb = talloc_asprintf(mem_ctx, DEFAULT_PROFDB, getenv("HOME"));
retval =
MapiLogonEx(mapi_ctx, &session, profname, NULL);
retval =
OpenFolder(&obj_store, id_inbox, &obj_folder);
while ((retval =
QueryRows(&obj_table, Denominator, TBL_ADVANCE, &rowset)) != -1 && rowset.cRows) {
for (i = 0; i < rowset.cRows; i++) {
retval =
OpenMessage(&obj_store, *fid, *mid, &obj_message, 0x0);
if (retval != MAPI_E_NOT_FOUND) {
}
}
}
talloc_free(mem_ctx);
return (0);
}