I need to import contacts from outlook into a web application. I think this is possible to make with JS, but I don't know how. Can anyone give me an example code for my problem?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
you can use activex and javascript to export outlook contacts, but it needs user to enable activex setting in browser, Also Firefox doesnot support activex, so your solution depends on IE. See following example:
function importContacts() {
try{
var objOutlook = new ActiveXObject( "Outlook.Application" );
}
catch(e){
alert("Outlook needs to be installed on the machine for data to export.");
return false;
}
ns = objOutlook.GetNamespace("MAPI");
if( ns )
{
als = ns.AddressLists;
if( als )
{
if( als.count > 0 )
{
al = als.Item(1);
aes = al.AddressEntries;
for( tmpi = 1; tmpi <= aes.Count; tmpi++)
{
ae = aes.Item(tmpi);
emai = ae.Address;
}
}
}
}
}