I'm applying a set of PR_ANR restriction to my MAPI table(IMAPITable).The goal for this query is to match input strings with accounts in GAL.
The error raised only when the input string is "x" or "s". hResult return hex value 80040403. Looking into MAPICode.h ,it says MAPI_E_TABLE_TOO_BIG.
But in fact, I've tried to type these two words (separately) into the Outlook GAL contact search box, and it has shown limited results.(54 results for s, 0 for x) It made me really confused about the returned table being too big.
Below is my c++ code(simplified):
//SRestriction setup
SRestriction pRestop = {};
SRestriction pPropRes[3] = {};
SPropValue sPropValue[2] = {};
//RES_AND
// RES_PROP(1)
// RES_PROP(2)
//RES_AND
pRestop.rt = RES_AND;
pRestop.res.resAnd.cRes = 3;
pRestop.res.resAnd.lpRes = &pPropRes[0];
//RES_Property -> First
pPropRes[0].rt = RES_PROPERTY;
pPropRes[0].res.resProperty.ulPropTag = PR_ANR_W;
sPropValue[0].ulPropTag = PR_DISPLAY_NAME_W;
sPropValue[0].Value.lpszW = tmp1; //first string
pPropRes[0].res.resProperty.lpProp = &sPropValue[0];
//RES_Property -> Second
pPropRes[1].rt = RES_PROPERTY;
pPropRes[1].res.resProperty.ulPropTag = PR_ANR_W;
sPropValue[1].ulPropTag = PR_DISPLAY_NAME_W;
sPropValue[1].Value.lpszW = tmp2; //second string
pPropRes[1].res.resProperty.lpProp = &sPropValue[1];
//tmp1 can be equal to tmp2
enum
{
accPR_DISPLAY_NAME_W,
accPR_SMTP_ADDRESS_W,
accNUM_COLS
};
static SizedSPropTagArray(accNUM_COLS, accCols) = {
accNUM_COLS, PR_DISPLAY_NAME_W, PROP_TAG(PT_UNICODE, 0x39FE)};
// Initialize MAPI, Log on to MAPI, Open the Address Book...
// Open GAL address book, Get content table(pHTable),
// Query phTable
if (FAILED(hRes = HrQueryAllRows(pHTable, (LPSPropTagArray) &accCols, &pRestop, NULL, 0L, &pRows))) goto Cleanup; //this is where the error raised
I've seen Microsoft doc and search for several posts but cannot find a proper way to debug this. So I'm wondering what situation might happened in the HrQueryAllRows method and how can I handle this error?