[Note]
1. WAB is not stored in each record information 2. IdistList is not a folder information, but group information. 3. Method: First take the entryid and folder name of each folder, and then get the container to which this folder belongs will be obtained. Reverse the Container Table gets all the records in Table. 4. This method has a shortcomings, there is no way to read the records in Share Folder.
// Read Outlook Express Communication Mandi (Folder, Name, Email) Void CGETEMAILDLG :: Onok () {HRESULT HRES; LPADRBOOK LPADRBOOK; LPWABOBJECT LPWABOBIECT
DWORD reserved2 = null;
HINSTANCE hinstLib; hinstLib = LoadLibrary ( "C: // Program Files // Common Files // System // wab32"); fWABOpen procWABOpen; WAB_PARAM wp = {0}; wp.cbSize = sizeof (WAB_PARAM); // Only want TO DEAL with "main Identity's Contacts" wp.ulflags = WAB_ENABLE_PROFLILES; // Set this value, indicating that only the current identity WAB. Remove Share Folder if (hinstlib! = null) {// Get "WAB32.DLL" internal Number of Wabopen ProCwabopen = (fwabopen) GetProcaddress (Hinstlib, "Wabopen");
IF (procwabopen! = null) {hres = (procwabopen) (& lPadrbook, & lpwabject, & wp, reserved2); _ASSERTE (hres == s_ok); if (hres! = s_ok) exit (1);
Ulong lpcbentryid; entryid * LpenTryid; hres = lpadrbook-> getpab (& lpcbentryid, & lpenTryID);
_Asserte (hres! = S_ok) exit (2); ulong ulflags = mapi_best_access; ulong ulobjtype = null; lpunknown lpunk = null; hres = lpadrbook-> OpenENTRY (lpcbentryid, 0, // If the value is set to 0, the obtained will be all directories in WAB. If it is set to & lpenTryID, all contact records NULL, ULFLAGS, & ULOBJTYPE, & lpunk);
Ulflags = WAB_LOCAL_CONTAINERS; // Here Ulflags If set to WAB_PROFILE_CONTENTS, it means that all records are obtained in Container. Resulting in each folder are read out of the recording of all recording // ulFlags = WAB_PROFILE_CONTENTS; if (ulObjType == MAPI_ABCONT) {IABContainer * lpContainer = static_cast
m_ListEmail.ResetContent (); SRow * lpRow = NULL; SPropValue * lpProp = NULL; BOOL bNotFolder = FALSE; IABContainer * lpContainer2 = NULL; LPENTRYID lpEID; ULONG cbEID; for (ULONG i = 0; i
IF (LPPROP-> ULPROPTAG == Pr_ENTRYID) {lpeid = (LpenTryID) LPPROP-> value.bin.lpb; cbeid = lpprop-> value.bin.cb;} if (lpprop-> ulproptag == pr_Depth) {IF lpProp-> Value.l == 0) {bNotFolder = TRUE; break;}}} if (bNotFolder) continue; hRes = lpContainer-> OpenEntry (cbEID, lpEID, NULL, ulFlags, & ulObjType, (LPUNKNOWN *) & lpContainer2); LPMAPITABLE lpTable2 = NULL; hRes = lpContainer2-> GetContentsTable (ulFlags, & lpTable2); ULONG ulRows2; hRes = lpTable2-> GetRowCount (0, & ulRows2); SRowSet * lpRows2; hRes = lpTable2-> QueryRows (ulRows2, // get all rows 0, & lprows2); for (ulong i = 0; i