Поделиться через


New Sample Transport Provider

I've been working with MAPI for over 5 years now.  In that 5 years I've supported my share of developers writing their own MAPI providers (message store, transport, address book), but I've never actually sat down and written one myself.  Until now ;-)

I decided to do a transport, since we already *kinda* have a message store, and we don't really get a lot of support cases for address book providers.

So, here it is.  I based the actual delivery mechanism on the PeerXP sample from way back.  Messages are stored as files on disk, and e-mail addresses are UNC share paths.

Development was done with Visual Studio 2003 (unmanaged C++ of course!) and testing was done with Outlook 2003 SP2.  I included my development notes with the source, and there's a README on basic installation and usage.

Feedback is welcome!

Comments

  • Anonymous
    November 21, 2005
    I may have found a small bug in DoConfigDialog() in mrxp.cpp. You create a variable and start a loop based on that variable, but if any function calls inside the loop fail, you don't fail the loop variable too.

    HRESULT hResValidConfig = MAPI_E_UNCONFIGURED;
    while (MAPI_E_UNCONFIGURED == hResValidConfig)
    {
    hResValidConfig = S_OK;
    hRes = pSupObj->DoConfigPropsheet(
    ulUIParam, 0, (LPTSTR)szDialogTitle, pTableObj,
    pPropDataObj, 0);
    if (SUCCEEDED(hRes))
    {
    ...
    }
    else
    {
    Log(true,
    _T("DoConfigDialog: DoConfigPropSheet returned an
    error: 0x%08Xn"), hRes);
    }
    ...
    }

    In that else, shouldn't you be setting hResValidConfig to MAPI_E_UNCONFIGURED? Assuming the propsheet couldn't be done the first time, I don't know if it would ever be able to display. As written, I don't see how you would ever exit the while loop in if that call, or the later call to pPropDataObj->GetProps() fails.

    Am I missing something?

    Mark

  • Anonymous
    December 28, 2005
    Thanks for the feedback Mark!

    The loop should be exited if hResValidConfig is not equal to MAPI_E_UNCONFIGURED. Note that the first thing I do there is set hResValidConfig to S_OK. If DoConfigPropSheet fails, then hResValidConfig is still S_OK, so we shouldn't repeat the loop.

  • Anonymous
    July 09, 2007
    I managed to waste half a morning figuring out something I'm supposed to already know. Dev asked if I

  • Anonymous
    July 09, 2007
    I managed to waste half a morning figuring out something I'm supposed to already know. Dev asked