Question

I'm pretty much new to MAPI and haven't wrote much C++ Code.

Basically I want to read all emails in the inbox and filter them based on their subject text. So far I'm using the source code provided at the microsoft msdn website which basically reads all emails from the inbox. What I want now is to not get all emails but filter them on the subject, lets say: I want all emails in my Inbox with the subject title "test".

So far I figuered out that the following line of code retrieves all the mails:

 hRes = HrQueryAllRows(lpContentsTable, (LPSPropTagArray) &sptCols, &sres, NULL, 0, &pRows);

The parameter &sres is from the type SRestriction.

I tried to implement a filter on 'test' in the subject:

sres.rt = RES_CONTENT;
sres.res.resContent.ulFuzzyLevel = FL_FULLSTRING;
sres.res.resContent.ulPropTag = PR_SUBJECT;
sres.res.resContent.lpProp = &SvcProps;

SvcProps.ulPropTag = PR_SUBJECT;
SvcProps.Value.lpszA = "test";

ScvProps is from the type SPropValue.

If i execute the application then I get 0 lines returned. If I change the String test to an empty String then I get all emails.

I'm assuming i'm using the "filter" option wrong, any ideas?

Edit: When I change the FuzzyLevel to:

sres.res.resContent.ulFuzzyLevel = FL_SUBSTRING;

then I can look for subjects that contain a single character but as soon as I add a second character I get 0 rows as result. I'm pretty sure this is just some c++ stuff that I don't understand that causes all this problems ...

No correct solution

OTHER TIPS

I figured the problem out.

Replacing

sres.res.resContent.ulFuzzyLevel = FL_FULLSTRING;
sres.res.resContent.ulPropTag = PR_SUBJECT;
SvcProps.ulPropTag = PR_SUBJECT;

with

sres.res.resContent.ulFuzzyLevel = FL_SUBSTRING;
sres.res.resContent.ulPropTag = PR_SUBJECT_A;
SvcProps.ulPropTag = PR_SUBJECT_A;

fixed the problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top