使用JS从outlook导入联系人 [英] Import contacts from outlook with JS

查看:168
本文介绍了使用JS从outlook导入联系人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将Outlook中的联系人导入Web应用程序。我认为这可以用JS制作,但我不知道如何。任何人都可以给我一个示例代码来解决我的问题吗?

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?

推荐答案

您可以使用activex和javascript导出Outlook联系人,但它需要用户在浏览器中启用activex设置,Firefox也不支持activex,因此您的解决方案依赖于IE。请参阅以下示例:

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;


                           }
                    }
                }
            }
        }

这篇关于使用JS从outlook导入联系人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆