Import contacts from outlook with JS
I need to import contacts from outlook into a web application. I think thi开发者_StackOverflow社区s is possible to make with JS, but I don't know how. Can anyone give me an example code for my problem?
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;
}
}
}
}
}
精彩评论