none
MAPI works in Visual Studio only RRS feed

  • Question

  • Hi,

    I encounter a very strange problem. I have a program that will create a PST file and then add some folders and items into it.

    If I debug the program in Visual C++(VS 2008), then everything is OK.

    But if I run the debug verson outside Visual C++, then only the PST file can be created. The folders and items cannot be added, even though the functions return successful values. I try to run the debug version as administrator, but still fails.

    My OS: Windows 7(32bit)

    My Outlook version: Outlook 2010(32bit)

    What is the problem?

    Thanks


    • Edited by chcw Tuesday, November 22, 2016 2:57 AM
    Tuesday, November 22, 2016 2:41 AM

All replies

  • So which MAPI calls fail?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Tuesday, November 22, 2016 5:09 AM
  • Hi,

    That is the problem.

    In Visual C++ Debugger, every MAPI call is successful and the program works properly.

    But outside the debugger, the program can only create PST file, but cannot add folders and items to the PST file.

    Since there are hundreds of MAPI calls, I have to add check statements to some of them. For example, check if the folder creation is successful or not, and pop up a message to indicate the result. And with the debug version, outside the debugger, the checked statements are always successful.

    Tuesday, November 22, 2016 5:41 AM
  • You'd need to check each and every call and logs its returned value. There is simply no way around that.

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Tuesday, November 22, 2016 6:02 AM