locked
Error on the creation of ActiveXObject(“Outlook.Application ”) in web worker RRS feed

  • Question

  • Hi

    I have a simple html file and a couple of JS files which perform async operation using web worker. I need to create ActiveX object for Outlook in order to get the Outlook Object Model functionality to retrieve a large set of Outlook tasks. I create ActiveXObject("Outlook.Application") in web worker JS file. But when I browse my html file through IE10 I'm getting "Automation server can't create object" on the ActiveXObject creation step.

    As far as I know this error is about Internet Security settings. So I allowed ActiveX and set "Enable for Initializing and Script ActiveX controls not marked as safe" under the ActiveX controls and plug-ins in IE. But it doesn't help. The interactions in JS files are OK as I checked the work without using ActiveX.

    Here is the html and scripts

    index.html:

    <html>
        <head>
            <script src="my_script.js" type="text/javascript"></script>
        </head>
        <body>
            <input type="button" onclick="javascript:showTasksCount();" value="Show Tasks count" />
        </body>
    </html>

    my_script.js:

    function display(count) {
            alert("Number of tasks: " + count);
    }
    function showTasksCount() {
        var myWorker = new Worker("web_worker.js");
        myWorker.onmessage = function (oEvent) {
            display(oEvent.data);
        };
        myWorker.postMessage("");
    }

    and

    web_worker.js:

    onmessage = function (oEvent) {  
        var outlook = new ActiveXObject("Outlook.Application");
        var count = outlook.GetNamespace("MAPI").Folders(1).Folders("Tasks").Items.Count;
        postMessage(count);
    };

    Could you please advise how to resolve it and if it's possible to use ActiveX with web worker?

    Thank you in advance.

    Best regards,

    Oleg

    Tuesday, July 16, 2013 8:31 AM

All replies

  • Hi Oleg,

    have you already found an answer to this question? Thanks!

    Kind regards
    Jaulz


    • Edited by jaulz Wednesday, November 13, 2013 3:44 PM
    Wednesday, November 13, 2013 3:44 PM