Using MAPI w / C ++, how can I open another user's Inbox?

I want to write an automated monitor script to programmatically fetch information from another Exchange 2003 mailbox. I have C ++ code to log into MAPI and connect to my own mailbox. I can also use the Control Panel-> Mail applet to set up another user's mailbox in my profile and my code can access that path. However, it was done on my desktop with Outlook installed, which provides a richer mail profile editor.

Since this will work on the server, I would prefer not to install Outlook at all. I can install the MAPI client instead . Then I create a simple MAPI application that issues the mail profile wizard using MAPILogonEx()

with a flag MAPI_LOGON_UI

. However, the main MAPI client has no functionality to configure another user's mailbox. As a requirement, I can run this script as a service account of the monitoring application, so I cannot say that it runs as the account whose mailbox I want.

Can I connect to a different user's mailbox (assuming permissions have already been granted) using the primary MAPI client? Or is it absolutely necessary to install Outlook for this feature?

+1


source to share


3 answers


I see ... I'm not sure how to do this explicitly; which is usually a side effect of the call CreateStoreEntryID

with the wrong flags. You probably want:

  • Get IID_IExchangeManageStore

    from your default message store
  • Call CreateStoreEntryID

  • Then open this repository with the post id

    LPEXCHANGEMANAGESTORE mapiObject = NULL;
    
    store->QueryInterface( IID_IExchangeManageStore, (LPVOID *) &mapiObject);
    
    mapiObject->CreateStoreEntryID( server, mailbox, OPENSTORE_TAKE_OWNERSHIP | 
        OPENSTORE_USE_ADMIN_PRIVILEGE, &len, &buffer);
    
    //Call OpenEntry on the entry id
    
          



If you would like a more detailed example, find the MFC MAPI project source for CreateStoreEntryID

. If you have any other questions, the best answer is the newsgroup microsoft.public.win32.programmer.messaging

.

+1


source


I highly recommend using the Microsoft Exchange MAPI client (as you linked already). It is designed to be more robust than these versions of Outlook. You should find an API other than Outlook and Exchange Server regarding extended MAPI.



You will need to use extended MAPI (as described in Cain TS Random) to open other mail stores, and of course, your application must be registered as a Windows user with the appropriate permissions on the Exchange server.

+1


source


Have you looked into ConfigureMsgService? I believe it works with Exchange MAPI, or are you saying you tried it and it didn't work?

0


source







All Articles