bernhof
bernhof

Reputation: 6320

Display new e-mail in Outlook

  1. Windows application invokes business logic
  2. Business logic creates new e-mail using Exchange Web Services and returns Entry ID of e-mail to Windows application
  3. Windows application attempts to find and display new e-mail via Outlook Interop based on the Entry ID of the e-mail.

The above doesn't work when using Cached Exchange Mode. Outlook only checks the local cache for the message, and since it was just created on the server, it won't be immediately available locally.

However, it works just fine when the account isn't using Cached Exchange Mode, because Outlook checks the Exchange Server for the e-mail.

So, the question:

How do I ensure that Outlook checks the Exchange Server instead of the local cache, or at least syncs with the server before looking for the message?

Here's the (simplified) code we use to display e-mails based on their Entry IDs:

void ShowEmail(string entryId)
{
  // (COM release and error handling removed for readability)
  var app = new Microsoft.Office.Interop.Outlook.Application();
  var ses = app.Session;
  var mailItem = 
    (Microsoft.Office.Interop.Outlook.MailItem)ses.GetItemFromID(entryId);
  mailItem.Object.Display(true);
}

Upvotes: 3

Views: 673

Answers (1)

SliverNinja - MSFT
SliverNinja - MSFT

Reputation: 31651

You have no control over the upload or sync of the mailbox. See this post. If the user is using Cached Exchange Mode - they can't use this feature.

If you have access to the registry - you could try disabling Cached Exchange Mode, and then re-enabling it. See this post which modifies the registry to enable/disable CEM.

Upvotes: 2

Related Questions