Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. MAPI problem

MAPI problem

Scheduled Pinned Locked Moved C / C++ / MFC
help
1 Posts 1 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    chepuri_uk
    wrote on last edited by
    #1

    The following code is from MSDN MAPI sample: after compiling and running it's giving error: Any help on this... #include "stdafx.h" #include "mapix.h" #include "mapiutil.h" HRESULT GetMAPIStatus(LPMAPISTATUS *pStatus, LPMAPISESSION pSession); int main(int argc, char* argv[]) { LPMAPISESSION pSession = NULL; //MAPI Session Pointer LPMAPISTATUS pStat=NULL; //MAPI Status Pointer HRESULT hRes = S_OK; //Initialize MAPI. hRes = MAPIInitialize(NULL); //Log on to MAPI and get a session pointer. hRes = MAPILogonEx(0, NULL, NULL, MAPI_LOGON_UI | MAPI_NEW_SESSION, &pSession); //hRes = MAPILogonEx(0, "umakanthch", "chepuri_uk", MAPI_LOGON_UI | MAPI_NEW_SESSION, &pSession); if (hRes == S_OK && pSession) //if logon OK get a status pointer. { //Call function to get the status pointer. hRes = GetMAPIStatus(&pStat, pSession); if(hRes == S_OK && pStat) //if we successfully got a status pointer call FlushQueues on it. { //Flush inbound and outbound messages. hRes = pStat->FlushQueues(NULL, 0, NULL, FLUSH_UPLOAD | FLUSH_DOWNLOAD); if(hRes == S_OK) MessageBox(NULL, "FlushQueues OK!", "FlushQueues", MB_OK); else MessageBox(NULL, "FlushQueues Failed!", "FlushQueues", MB_OK); } else MessageBox(NULL, "GetMAPIStatus Failed!", "FlushQueues", MB_OK); pSession->Logoff(NULL, 0L, 0); } else { MessageBox(NULL, "MAPI Logon Failed!", "FlushQueues", MB_OK); } //Clean up pointers. UlRelease(pStat); UlRelease(pSession); MAPIUninitialize(); // MessageBox(NULL, "End of MAPI ", "FlushQueues", MB_OK); return 0; } ///////////////////////////////////////////////////////////////// // Gets the spooler's status object from the session status table. ///////////////////////////////////////////////////////////////// HRESULT GetMAPIStatus(LPMAPISTATUS *pStat, LPMAPISESSION pSession) { LPMAPITABLE pTbl = NULL; LPSRowSet pRow = NULL; HRESULT hRes; SRestriction sres; SPropValue spv; ULONG ulObjType; int cbEID; LPENTRYID pbEID; const static SizedSPropTagArray(2,sptCols) = {2,PR_RESOURCE_TYPE,PR_ENTRYID}; if (FAILED(hRes = pSession -> GetStatusTable(0,&pTbl))) { MessageBox(NULL, "GetStatusTable Failed!", "GetStatusTable", MB_OK); goto Quit; } sres.rt = RES_PROPERTY; sres.res.resProperty.relop = RELOP_EQ; sres.res.resProperty.ulPropTag = PR_RESOURCE_TYPE; sres.res.resProperty.lpProp = &spv;

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups