Calling an ActiveX method from javascript in Outlook webview RRS feed

  • Question

  • Hello MSDN community

    I'm currently writing a project to integrate some custom views and forms in Outlook 2010. The idea is to create an Outlook extension connected to our ERP. As discovered in this sample project (, one technique is to build an ActiveX component and load it from a lightweight local html page, like this :

        <body rightmargin = '0' leftmargin ='0' topmargin ='0' bottommargin = '0' onload='OnBodyLoad()'>
        <object classid='clsid:f746a8b6-3659-4f4c-8518-6336187854f2' ID='MyView' VIEWASTEXT width='100%' height='100%'/>
            function OnBodyLoad() {
                try {
                    var oApp = window.external.OutlookApplication;
                    var view = document.getElementById('MyView');
                catch(err) {

    As you can see the Outlook application instance is passed to the Initialize() method for further access from the ActiveX (this is the important point for me).

    The C# class looks like this :

    public partial class MyView : UserControl
        public MyView()
        public String Str { get; set; }
        public void Initialize(Object app)
        private void button1_Click(object sender, EventArgs e)
            MessageBox.Show(this, "It works!");

    It's signed and registered with RegAsm. When I load it in IE, it works like a charm. I get the message "Initialized" at startup, and when I click on button1, the message "It works" pops up too.

    BUT (there is of course a 'but' :) when I load this page in Outlook (folder properties / home page), the ActiveX component gets loaded and visible, but the Initialize call throws this error: "Object doesn't support this property or method". Clicking the button1 works.

    Trying to assign something to the property from Str with javascript fails in Outlook too, and works in IE.

    Did anyone here face the same problem, and knows what I'm missing?

    Many thanks in advance,



    • Edited by toxnico Monday, November 10, 2014 8:29 AM
    Monday, November 10, 2014 8:28 AM


All replies

  • Hello Nico,

    You are referring to the article dated January 2006. As you see, it is quite an old page.

    Outlook applies very strict security rules to the hosted home pages. Instead, I'd recommend subclassing the Outlook window using Windows API functions. See Adjacent Windows In Outlook for more information.

    Also, you may find helpful a commercial SDK which allows to add such forms out of the box (they call it WebViewPane):

    Be aware, You cannot add a URL to the Address box on the Home Page tab in Outlook 2007 .

    • Edited by Eugene Astafiev Monday, November 10, 2014 9:33 AM
    • Marked as answer by toxnico Monday, November 10, 2014 10:43 AM
    Monday, November 10, 2014 9:32 AM
  • Hello Eugene, and thanks a lot for your answer!

    I precisely wanted to avoid manipulating Outlook at low level using some hardcore windows API :)

    That's why I was well inspired by the webview approach!

    But thanks for this information and the link to addin express, i'll check that.

    Best regards,


    Monday, November 10, 2014 10:42 AM