Aspose.Email Editing Contact "FN:" Field


#1

Hello, I was trying to edit a contact as an MapiContact. When it was created, it had this FN field. I was wondering if there was a way to modify it since the following line of code only added the N field. Setting the display name also worked when output to console (with contact.NameInfo.DisplayName = “something”), but not in the saved file.

contact.NameInfo = new MapiContactNamePropertySet(“test”, “test”, “test”);

Example .vcs file:

BEGIN:VCARD
VERSION:2.1
N:test;test;test
FN:Original Sender1
ORG:Test Org
EMAIL;TYPE=INTERNET:originalsender@test.com
END:VCARD


#2

@awalker1,

We were able to observe the problem with the VCF contact type for updating display name information. It has been logged as EMAILNET-39042 for further investigation at our end. We’ll update you here once there is some information or a fix version available in this regard.

We also noticed that the change is visible if we save the message in MSG format. Sharing just in case it may be of any help to you.


#3

Thank you for confirming it is an issue. For now, what I may be able to do is create a new MapiContact object and recreate the contact with an empty “FN” field if the original vcard did not include first, last, and middle but only had that “FN” field.

I was also wondering the best way to change the “From” header of an MapiContact object even if that included converting to another object.


#4

@awalker1,

Could you please elaborate your requirement in more detail? If possible, please assist us with the help of sample input and expected output files for our reference.


#5

Basically, I ended up creating a new MapiContact object from scratch but am still unable to set that FN field with Aspose if it never had the individual name parts.

I am able to set the subject field like Outlook normally would to file as, but also wanted to know how to set the from field since this does not seem to be an option for MapiContact. This From field may have been set by Outlook once I opened the contact and only had my name, but not an email address.

I guess I would have to convert MapiContact to another object and then back?

Example headers in .eml format of MapiContact:
Message-ID: <809079ec48ac47afbd83eb4d6ad78f1a>
From: “Last, First” <------------------------------------------------------ desired to change
Subject: Modified Sender1(Aspose.Email Evaluation) <--------- was able to change as MapiContact
Date: Tue, 10 Jul 2018 19:26:15 +0000
X-Unsent: 1
MIME-Version: 1.0
Content-Type: multipart/alternative;


#6

@awalker1,

Please give a try to the following code sample and let us know your feedback.

MapiContact contact = new MapiContact("Display name", "address@domain.com", "Company ABC");

MemoryStream ms = new MemoryStream();

contact.Save(ms, ContactSaveFormat.Msg);

ms.Position = 0;

MapiMessage msg = MapiMessage.FromStream(ms);

msg.SenderEmailAddress = "sender@domain.com";

contact = (MapiContact)msg.ToMapiMessageItem();

contact.Save("ContactFromMsg.msg", ContactSaveFormat.Msg);