如何使用ASP.NET导入电子邮件(Exchange服务器)中的联系人 [英] How to import contacts in a email (exchange server) using ASP.NET
本文介绍了如何使用ASP.NET导入电子邮件(Exchange服务器)中的联系人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从我的数据库中将联系人导入邮箱(交换服务器),并且当用户登录该电子邮件时,应该可以从任何地方访问联系人。
与特定电脑的前景仍然有限。
我尝试过:
我没有尝试任何东西,因为我没有得到任何尝试。
I want to import contacts into a mailbox (exchange server) from my DB and that contacts should be access from anywhere when user login to that email.
Unlike outlook that remains limited for specific computer.
What I have tried:
I tried nothing as I don't get anything to try.
推荐答案
我得到了解决方案
这里是我的代码
I got the solution
here is my code
ExchangeService service = new ExchangeService();
service.Credentials = new NetworkCredential(username, password);
service.AutodiscoverUrl(emailaddress);
Contact contact = new Contact(service);
contact.GivenName = "ABC";
contact.Surname = "XYZ";
contact.FileAsMapping = FileAsMapping.SurnameCommaGivenName;
contact.PhoneNumbers[PhoneNumberKey.HomePhone] = "";
contact.EmailAddresses[EmailAddressKey.EmailAddress1] = new EmailAddress("abc@yourdomain.com");
contact.Save(WellKnownFolderName.Contacts);
这篇关于如何使用ASP.NET导入电子邮件(Exchange服务器)中的联系人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文