Outlook Programming Series # 13 : Programmatic equivalent for Outlook UI's Send/Receive

Whenever we work with Outlook 2007 UI, we click either "Send/Receive button" or press "F9" to send and receive emails. In couple of our cases we use to do programmatically you can make use of Outlook Object Model's (OOM) SendAndReceive method. You need to know that calling the SendAndReceive method is synchronous only.

Syntax: expression.SendAndReceive(showProgressDialog)

Here, showProgressDialog - Indicates whether the Outlook Send/Receive Progress dialog box should be displayed, regardless of user settings


  • SendAndReceive provides the programmatic equivalent to the Send/Receive All command that is available when you click Tools and then Send/Receive.
  • If you do not need to synchronize all objects, you can use the SyncObjects collection object to select specific objects. For more information, see NameSpace.SyncObjects .
  • All accounts defined in the current profile are used in Send/Receive All.
  • If an online connection is required to perform the Send/Receive All, then the connection is made according to user preferences.

Using with Outlook Object Model & Visual Basic 6:

Use NameSpace.SendAndReceive Method. Initiates immediate delivery of all undelivered messages submitted in the current session, and immediate receipt of mail for all accounts in the current profile.

Using in .Net environment & Outlook interop:

Use NameSpaceClass.SendAndReceive Method (Microsoft.Office.Interop.Outlook). The types and members of the Microsoft.Office.Interop.Outlook namespace provide support for interoperability between the COM object model of Microsoft Office Outlook 2007 and managed applications that automate Outlook.

This is a .NET class or a member of a .NET class created when processing a COM coclass that is required by managed code for interoperability with the corresponding COM object. Use this class only when you have to access an earlier event in this class that has been subsequently extended in a later version of Outlook. Otherwise, use the .NET interface derived from the COM coclass.

Code snippet (used in the add-in):


    1:  public virtual void _NameSpace.SendAndReceive (
    2:      [InAttribute] bool showProgressDialog
    3:  )

then we need to use the SyncObject,

    1:  //trap the SyncObject.SyncStart Event 
    2:    this.Application.Session.SyncObjects[1].SyncStart += new Microsoft.Office.Interop.Outlook.SyncObjectEvents_SyncStartEventHandler(ThisAddIn_SyncStart);
    4:  //finally don't forget to trap the SyncObject.SyncEnd Event 
    5:  this.Application.Session.SyncObjects[1].SyncEnd += new Microsoft.Office.Interop.Outlook.SyncObjectEvents_SyncEndEventHandler(ThisAddIn_SyncEnd);

Visual Basic:

    1:  Dim instance As NameSpaceClass
    2:  Dim showProgressDialog As Boolean
    4:  CType(instance, _NameSpace).SendAndReceive(showProgressDialog)