outlook code modification

the following code executes in the some machines..but it fails in some machines...please help and point out the line to be modified

var app= new ActiveXObject("Outlook.Application")

nameSpace = app.GetNamespace("Mapi")

var AddLists = nameSpace.AddressLists

var AddEntries = AddLists.Item(1).AddressEntries

var AddEntry = AddEntries.GetFirst

for(i=1;i<AddEntries.Count;i++)

{

alert(AddEntry.Address);

AddEntry = AddEntries.GetNext;

}




Answer this question

outlook code modification

  • Seabhcan

    Per our support engineer:

    There is a little problem: for (i=1;i<AddEntries.Count;i++) this is the problem. If there is only one record in outlook, then you can’t get any entry. So it should be like this: for (i=0;i<AddEntries.Count;i++).

    This is the first possibility that you can’t access the function. The second is the IE security problem. You may haven’t the access permission of javascript or ActiveX.

    Your outlook also should allow your program to access the resources.

    When you run the program the outlook will open a window to ask you whether allow the program to access the resources. If you do not choose allow, the program can not access the resources. Some users may haven’t the permission of external access. You need to change the settings of your outlook.

    -brenda (ISV Buddy Team)



  • Shoaib Aleem

    per our support engineer:

    I can’t repro this problem on our machine.

    You can try to set IE security settings to LOW first. To see whether it can works. Another thing to confirm is have you installed outlook on that machine Error information is that it hasn’t found that component.

    -brenda (ISV Buddy Team)



  • Shane Colin

    when i execute the script i'm getting the error as "Automation Server can't create object"

    so please tell me where should i change my settings...

    Regards

    Kalyan Kamesh



  • outlook code modification