Search code examples
outlookoffice-interopoutlook-addin

Non English Outlook: Outlook hangs if a change to a document is made.


I encountered an issue which does not replicate in an English version of Outlook 2013.

If I grab a MailItem's Document.Content and change its Text property, after closing the Inspector, Outlook will hang and I will have to kill the process with Task Manger.

This is the code I am running:

    class Program
    {
        public Program()
        {
            Outlook.Application appOutlook;
            appOutlook = (Outlook.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Outlook.Application");

            Outlook.Inspector insp = appOutlook.ActiveInspector();
            Word.Document doc = insp.WordEditor;

            if (doc.ProtectionType != Word.WdProtectionType.wdNoProtection)
            {
                doc.Unprotect();
            }

            doc.Content.Text = "test";
            Console.ReadLine();
        }

        static void Main(string[] args)
        {
            Program program = new Program();
        }       
    }

Again, this works smoothly in English, but hangs the application in German for instance - and in other languages as well.

I have noticed that closing the Reading Pane prevents Outlook from hanging.

Any help will be appreciated.


Solution

  • Changing the WWLIB.dll to the most updated one solved the issue.