Search code examples
c#asp.netexchangewebservicesoutlook-web-app

Outlook Web App doesn't show contact name


I'm working on a CRM application to sync CRM data to Exchange using a service I'm writing in C#. After instiating the EWS connection:

ExchangeService es = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
es.AutodiscoverUrl("SamGam@TheShire.com");

I can create a contact and edit the details:

...
Contact contact = new Contact(es);
contact.GivenName = "Samwise";
contact.Surname = "Gamgee";
contact.DisplayName = "Samwise Gamgee";
...

Then save it

...
contact.Save();

And now it will appear in the user's exchange contact mailbox. In the desktop version of Outlook it looks ok:

Desktop Outlook

But in the Outlook web app I see this:

Web App Outlook

Not showing the name and having Untitled Contact eliminates any usability for a real user. If I double click on the contact in the list to edit the details I get this showing the First name and Last name.

enter image description here

And then if I save it the name will appear in the contact list and view details.

Is there anything I can do to have it appear in the list automatically for users who use the outlook web app?

Thanks!


Solution

  • You should be setting the FileAs mapping and I would also always set the Subject field to the displayname as this can also cause problems eg

    contact.FileAsMapping = FileAsMapping.SurnameCommaGivenName;
    contact.Subject = "Samwise Gamgee";
    

    On 2013 and Office365 there is also a few other properties you should set see https://social.msdn.microsoft.com/Forums/sqlserver/en-US/90d7e749-977e-4191-87cf-725007a326b4/contacts-created-by-ews-v20-are-visible-in-outlook-but-not-in-owa-in-office-365?forum=exchangesvrdevelopment