Graeme
Graeme

Reputation: 1667

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.

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. 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. I read there is meant to be a ResolveNames method but that's not in the API either.

Any help appreciated

Upvotes: 0

Views: 1004

Answers (1)

Glen Scales
Glen Scales

Reputation: 22032

Autodiscover can return that for multiple users eg

        AutodiscoverService adService = new AutodiscoverService(ExchangeVersion.Exchange2013_SP1);
        adService.Credentials = new NetworkCredential("[email protected]", "pass");
        adService.RedirectionUrlValidationCallback = adAutoDiscoCallBack;
        List<String> Users = new List<string>();
        Users.Add("[email protected]");
        Users.Add("[email protected]");
        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.

Upvotes: 1

Related Questions