none
MAPI not working in multi-process mode RRS feed

  • Question

  • Hi All,
       Greetings!!
        I am working on a requirement where we need to import e-mails in MSG format into PST files. I have written a tool in C++ and used MAPI API to import MSG files into PSTs. The tool consists of a .dll that uses different MAPI APIs to read MSG file and import it into a PST and a .exe that passes MSG filename and PST filename to the .dll. We need to invoke .exe thousands of time to import thousands of MSG files into PSTs. 

    I am observing following behaviour in my testing with outlook 2010:-

    1) When we are running single .exe repeatedly thousand of times by passing different MSG filenames and PST filenames each time, it works well without any error.
    2) When we are running multiple .exes simultaneously (thousand of times) by passing different MSG filenames and PST filenames each time, I am seeing random MAPI API failues as follows:-

    m_pIProfAdmin->CreateProfile() failed :: -2147024891 (MAPI_E_NO_ACCESS)
    MAPILogonEx failed :: -2147221231 (MAPI_E_LOGON_FAILED)
    m_pSvcAdmin->CreateMsgService() failed :: -2147467259 (MAPI_E_CALL_FAILED)
    OpenMsgStore() failed :: -2147221226 (MAPI_E_DISK_ERROR)

    Such failures are random in nature and about 10 transactions out of 500 are showing such failures. 
    In single process mode run, I never saw any failure at all. I also tried putting inter-process locks around MAPI API calls so that they become serial in nature, still I am getting these errors when I am invoking multiple .exes simultaneously.

    Are you aware of any known issue related to multi-process invocation of MAPI API related to profile management? How to address such failures in multi-process execution?

    Your inputs will help me to proceed ahead with my implementation.

    Thanks in advance,
    Yashpal
    Thursday, June 23, 2016 5:29 AM