leo*_*ora 2 c# outlook street-address
我能够使用outlook对象模型查看全局地址簿,但无论如何使用csharp中的outlook对象模型我可以获得一个人的以下属性:
城市,州,国家/地区Alias Title Phone
我似乎无法在AddressEntry对象上找到这些属性.
编辑:我在这里开始了赏金.我使用LDAP查询工作,但他们真的很痛苦.令我感到震惊的是,前景并不支持这种简单的api.我想知道是否有其他人得到它的工作或可以解释/证明为什么前景不会支持这一点
使用Microsoft.Office.Interop.Outlook
您需要在AddressEntry对象上使用ExchangeUser对象和GetExchangeUser方法.
using System;
using Microsoft.Office.Interop.Outlook;
static class Program
{
static void Main(string[] args)
{
ExchangeUser oExUser;
Application app = new Microsoft.Office.Interop.Outlook.Application();
foreach (AddressList addressList in app.Session.AddressLists)
{
if (addressList.Name == "Global Address List")
{
foreach (AddressEntry item in addressList.AddressEntries)
{
Console.WriteLine(item.Address);
oExUser = item.GetExchangeUser();
if (oExUser != null)
{
Console.WriteLine(oExUser.FirstName);
Console.WriteLine(oExUser.LastName);
Console.WriteLine(oExUser.StreetAddress);
Console.WriteLine(oExUser.CompanyName);
Console.WriteLine(oExUser.Department);
Console.WriteLine(oExUser.OfficeLocation);
Console.WriteLine(oExUser.JobTitle);
}
Console.WriteLine();
}
}
}
Console.Read();
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3552 次 |
| 最近记录: |