Free Support Forum - aspose.com

Issue in Display Name when creating a Contact Item (Java)

My goal is to create a .pst file with contact items formatted at my will, to be imported in Outlook.

When creating contact items using Java MapiContact class, I have a problem setting the “Display as” field in a contact item. Successfully calling

MapiContact contact = new MapiContact("firstname surname", "f.s@a.com")

and then saving the contact to a .pst file, I encounter this problem importing it to Outlook:

  1. Full name becomes: “firstname surname” (fine)
  2. File as becomes: “surname, firstname” (fine)
  3. Email becomes: "f.s@a.com" (fine)
  4. Display as becomes “firstname surname (f.s@a.com) (f.s@a.com)” (bad: email address twice!)

I want to be able to set the Display as field explicitly.

The version used is 19.2.

@gazonk.del,

You are using a fairly older API version and I suggest you to please try using latest Aspose.Email for Java 20.5 on your end. I hope this will resolve the issue. If you still face any issue, please provide the used sample code along with snapshot of the issue so that we may proceed further to help you.

Thanks for your attention!

Yes, I did resolve the problem. I created a contact item in Outlook containing a lot of fields and exported it to a .pst file. Using the API I read the contact item and investigated how all entities were set. No issue anymore. And I updated to 20.5. (Bit also using 20.5 before making any changes I got that funny display nme, presumably being the default setting by Outlook if left out in the generated .pst file.)
Again, thanks a lot!

@gazonk.del,

You are always welcome. It’s pleasing to know that your issue has been fixed by shifting to latest version.