Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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);
}
like image 586
bernhof Avatar asked Dec 22 '25 14:12

bernhof


1 Answers

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.

like image 51
SliverNinja - MSFT Avatar answered Dec 24 '25 02:12

SliverNinja - MSFT



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!