outlook-redemption

Is there a way to run NameSpace.SendAndReceive() from Redemption? Without opening the Outlook Object Model?


I am using a WPF app to loop through appointments and do some processing. If Outlook is not open, sometimes the calendar is not up to date. So, I'm running this method:

 private void SendAndReceive()
    {
        Microsoft.Office.Interop.Outlook.Application OutlookApp = new Microsoft.Office.Interop.Outlook.Application();
        Microsoft.Office.Interop.Outlook._NameSpace mapiNameSpace = OutlookApp.GetNamespace("MAPI");
        Outlook.NameSpace ns = OutlookApp.GetNamespace("MAPI");
        ns.SendAndReceive(false);
        if (ns != null) Marshal.ReleaseComObject(OutlookApp);
        if (ns != null) Marshal.ReleaseComObject(mapiNameSpace);
        if (ns != null) Marshal.ReleaseComObject(ns);
    }

This works fine however I don't want Outlook to open. It's visible on the system tray for a few moments and disappears.

Wondering if there's a way to accomplish the same thing using Redemption? If you could also provide a sample bit of code, that would be helpful.


Solution

  • There is not much you can do - Microsoft removed MAPI spooler from Outlook 2002, so MAPIUtils.DeliverNow has not worked ever since, and it is not even exposed by (newer) RDOSession object.

    The only workarounds are listed at https://www.dimastr.com/redemption/faq.htm#1