获取Outlook 2003收件人的电子邮件地址 [英] Get Outlook 2003 Recipient(s) Email Address

查看:82
本文介绍了获取Outlook 2003收件人的电子邮件地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我已经创建了一个针对Outlook 2003的VSTO(约会)应用程序.问题是我不知道如何掌握约会收件人的电子邮件地址.我很清楚,在Outlook 2007 VSTO中,可以使用以下代码来获取电子邮件地址,但这在Outlook 2003中不起作用:

Hi all,

I have created a VSTO (Appointments) application targeting Outlook 2003. The thing is that I have no idea how to get hold of the email address of the recipients of the appointment. I am well aware that in Outlook 2007 VSTO, one can use the following piece of code to get hold of the email address, but this does not work in Outlook 2003:

olRecipient.AddressEntry.GetExchangeUser().PrimarySmtpAddress;


我编写了以下方法,该方法的确可以保留收件人的电子邮件地址,但是它使用了LDAP,这是一个问题,因为每个客户端都需要用户名和密码....


I wrote the following method that does get hold of the recipients email address, but it makes use of LDAP, this is a problem seeing that each client will require a username and password....

public string LookupEmailAddress(string legacyExchangeDN)
{
    string emailAddress = String.Empty;
    DirectoryEntry de = new DirectoryEntry("LDAP://server.local", "username", "password");
    DirectorySearcher deSearch = new DirectorySearcher();
    deSearch.SearchRoot = de;
    deSearch.Filter = "(&(objectClass=user)(legacyExchangeDN=" + legacyExchangeDN + "))";
    deSearch.SearchScope = SearchScope.Subtree;
    try
    {
        SearchResult results = deSearch.FindOne();
        if (!(results == null))
        {
            de = new DirectoryEntry(results.Path, "username", "password", AuthenticationTypes.Secure);
            foreach (System.DirectoryServices.PropertyValueCollection o in de.Properties)
            {
                if (o.PropertyName == "mail")
                {
                    emailAddress = o.Value.ToString();
                }
            }
        }
    }
    catch (System.Exception)
    {
        return String.Empty;
    }
    return emailAddress;
}


有谁知道我如何掌握参加约会/会议的收件人的电子邮件地址?

提前非常感谢.
亲切的问候,

[正确的代码格式]


Does anyone know how I can get hold of the email address of the recipients attending the appointment / meeting?

Many thanks in advance.
Kind regards,

[Corrected code formatting]

推荐答案

答案可以在这里找到:

详细描述问题……第一部分任何方式 [ ^ ]

And the answer can be located here:

Describing the problem in detail ... well the first part any way[^]

How to fix - needs a bit of conversion between VB and C#[^]

Kind regards,


我遇到了同样的问题.我找到了一种解决方案

applicationObject.GetNamespace("MAPI").AddressLists [全局地址列表"] .AddressEntries [用户名"] .Details(0);

applicationObject是指向您的Outlook应用程序的指针,"USER NAME"几乎是发件人的用户名.这不能解决我的问题,但希望可以解决您的问题
I am running into the same problem. I''ve found one solution

applicationObject.GetNamespace("MAPI").AddressLists["Global Address List"].AddressEntries["USER NAME"].Details(0);

applicationObject is the pointer to your Outlook Application, and "USER NAME" is pretty much the sender''s user name. This does not solve my problem but hopefully it solves yours


这篇关于获取Outlook 2003收件人的电子邮件地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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