locked
Outlook object in Javascript RRS feed

  • Question

  • Hello,
     I am using javascript to create an outlook object and trying to read a public folder item. I am able to do so with outlook itself, but when I use javascript its giving me an error. 
    Error Number: -2147024891, Error Message: You do not have sufficient permission to perform this operation on this object.  See the folder contact or your system administrator.
    I am also able to access the mails through webmail.
    Any reason why this is happening?
    Following is the code:
    var oOutlook;
    var pub;
    var item;
    var safeobject;
    try
    {
        safeobject=
    new ActiveXObject("SafeBrowserScripting.ObjectGenerator");
    }
    catch(e)
    {
        oOutlook =
    new ActiveXObject("Outlook.Application.");
    }
    if(safeobject==null)
    {
        oOutlook =
    new ActiveXObject("Outlook.Application.");
    }
    else
    {
        oOutlook=safeobject.GetSafeObject(
    "Outlook.Application");
    }
    var folderId="18";
    pub = oOutlook.Session.GetDefaultFolder(folderId);
    item = oOutlook.Session.GetItemFromID(entryID, pub.StoreID);
    item.Display();
    }
    catch(e)
    {
        if ( e.number != 0 )
        {
            if ( e.number == "-2146823281" )
            {
                alert(
    "You do not have sufficient privileges to read the email.");
            }
            else
            {
                alert(
    "There was an error opening the Research email."); 
            }
            window.status =
    "";
            return;
        }
    }
    This is not happening with all users, its happening only with few users. I have been trying to fix this over 3 weeks now.

    Thanks
    Wednesday, October 22, 2008 6:21 PM

Answers