Outlook Send/Receive feedback RRS feed

  • Question

  • Hi all,

    I'm currently writing a tool that allows me to plug various scripts into it that all work together to automate deployment configuration. One of the scripts I have opens Outlook and invokes the Send/Receive command. What I need to do is identify when/if this task has completed successfully.

    I've looked in Event Viewer and cannot find anything written there by Outlook. The code I'm using is below and I could probably use the ProgressDialog window that shows to do this. I.e. check for the windows existence with API's.

    private static void DirectSendAndReceiveCall()
                Microsoft.Office.Interop.Outlook.Application OutlookApp = new Microsoft.Office.Interop.Outlook.Application();
                Outlook.NameSpace ns = OutlookApp.GetNamespace("MAPI");
                //TODO: could check for existence of the progress dialog window and once it's disappeared I can kill Outlook
                if (ns != null) Marshal.ReleaseComObject(ns);

    Effectively, I must know whether this has been a success or failure as other scripts may have a dependency on this one. What other possible ways might I achieve this?



    • Moved by Mike Dos Zhang Friday, May 18, 2012 8:30 AM Office dev (From:Visual C# General)
    Thursday, May 17, 2012 12:08 PM


All replies

  • Please use this Outlook for Developer forum.
    Have a good weekend!

    Mike Zhang[MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Jibrohni Friday, May 25, 2012 7:30 AM
    Friday, May 18, 2012 8:33 AM
  • what outlook version? I think in 2007 and higher you can monitor events on SyncObject item in Namespace.SyncObjects collection which contains events like OnStart, OnEnd, OnError. Usually sync all is a first item in that collection. Is that what you want?

    Friday, May 18, 2012 9:42 AM
  • DamianD,

    Thanks for that suggestion. It seems that OnEnd is just what I was after.

    Friday, May 25, 2012 7:30 AM