Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to detect if an item in Contacts folder is a subfolder?

0 views
Skip to first unread message

Angus

unread,
Dec 3, 2009, 4:15:31 PM12/3/09
to
Hello

Currently I can iterate contacts in the Outlook Contacts folder by
setting up a SizedSPropTagArray eg like this:

static SizedSPropTagArray(NUM_COLS,sptmyCols) = { NUM_COLS,
PR_SUBJECT,
PR_COMPANY_NAME,
PR_OFFICE_TELEPHONE_NUMBER,
PR_HOME_TELEPHONE_NUMBER,
PR_CELLULAR_TELEPHONE_NUMBER,
PR_ENTRYID
};

and then doing this:
LPMAPITABLE pTable = NULL;
HRESULT hr = pContactsFolder->GetContentsTable(0, &pTable);
LPSRowSet pRows = NULL;
hr = HrQueryAllRows(pTable, (LPSPropTagArray) &sptmyCols,
NULL,//restriction...we're not using this parameter
NULL,//sort order...we're not using this parameter
0,
&pRows);

But I want to also detect subfolders so I can retrieve contacts in
these subfolders. how do I do that?

Angus

Dmitry Streblechenko

unread,
Dec 3, 2009, 5:22:18 PM12/3/09
to
Call pContactsFolder->GetHierarchyTable, retrieve PR_ENTRYID for the
subfolders, use it to call IMAPISession::OpenEntry to get back teh
corresponding IMAPIFolder.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Angus" <angus...@gmail.com> wrote in message
news:e554c656-3eb4-4a9f...@d20g2000yqh.googlegroups.com...

0 new messages