简体   繁体   English

仅传递电子邮件地址时,从EWS获取显示名称

[英]Getting display name from EWS when passing in just an email address

I've using a custom GetMailTips SOAP call (since the EWS for Core 2.0 doesn't support it) to get Out of Office info for a batch of email addresses. 我正在使用自定义GetMailTips SOAP调用(因为EWS for Core 2.0不支持它)来获取一批电子邮件地址的外出信息。

How can I get the display names of the users that I am passing in the email address for? 如何获得我在电子邮件地址中传递的用户的显示名称?

I can call ResolveName of the managed API and that works but it has to be done one at a time and that is slow. 我可以调用托管API的ResolveName,它可以工作,但是必须一次完成一次,而且速度很慢。 I would like to ideally get this info out when I make my GetMailTips request and failing that make a call with all the email addresses to get the Display Names all at once. 当我发出GetMailTips请求时,如果要通过所有电子邮件地址进行呼叫以一次全部获得“显示名称”,则我希望在理想情况下获取此信息。 I read there is meant to be a ResolveNames method but that's not in the API either. 我读到有一个ResolveNames方法的意思,但这也不在API中。

Any help appreciated 任何帮助表示赞赏

Autodiscover can return that for multiple users eg 自动发现可以为多个用户返回该信息,例如

        AutodiscoverService adService = new AutodiscoverService(ExchangeVersion.Exchange2013_SP1);
        adService.Credentials = new NetworkCredential("user@d.com", "pass");
        adService.RedirectionUrlValidationCallback = adAutoDiscoCallBack;
        List<String> Users = new List<string>();
        Users.Add("user1@domain.com");
        Users.Add("user2@domain.com");
        GetUserSettingsResponseCollection usrSettings = adService.GetUsersSettings(Users, UserSettingName.UserDisplayName);
        foreach(GetUserSettingsResponse usr in usrSettings)
        {
            Console.WriteLine(usr.Settings[UserSettingName.UserDisplayName]);
        }

Another way would be to create a Message and add the email address as recipients then save it to the drafts folders and the address should get resolved against the GAL. 另一种方法是创建一条消息并将电子邮件地址添加为收件人,然后将其保存到草稿文件夹中,然后应根据GAL解析该地址。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM