开发者

Import contacts from outlook with JS

开发者 https://www.devze.com 2023-02-17 04:27 出处:网络
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 proble

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;


                           }
                    }
                }
            }
        }
0

精彩评论

暂无评论...
验证码 换一张
取 消