Free Support Forum - aspose.com

Organizer Format

Hi Aspose

Using the below ICS file and code, running Aspose.Email for Java 17.2, the Organizer is not correctly created. In particular it always adds a Display Name, which is used as part of the Contact card mail address when hovering over the name in Outlook after responding, causing send failures (“the email address is no longer valid…”).

What we would like is to remove the Display Name completely, so only the valid email address (e.g. name@domain.com) is used as the mail address in the Contact card when responding. We have tried removing the CN attribute, e.g. changing the ics file to;

ORGANIZER:mailto:Joe.User@xxyyzz.com

or this code;

if (calDoc.getOrganizer()!= null) {
MailAddress maOrg = new MailAddress(calDoc.getOrganizer().getAddress());
maOrg.setDisplayName(null);
calDoc.setOrganizer(maOrg);
}

But this still results in a Display Name being created in the email adddress, e.g. Joe.User@xxyyzz.com Joe.User@xxyyzz.com, and the same problem occurs.

Can you please explain how we can achieve this?

Thanks

ICS File test.ics
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//IONET Software//NONSGML Testing//EN
METHOD:PUBLISH
BEGIN:VEVENT
CLASS:PUBLIC
DTSTART:20170401T090000
DTEND:20170401T100000
TRANSP:OPAQUE
ORGANIZER;CN=Joe User:mailto:Joe.User@xxyyzz.com
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;CN=Bob User
;RSVP=TRUE:mailto:Bob.User@xxyyzz.com
LAST-MODIFIED:20170327T204644Z
DTSTAMP:20170327T204620Z
SEQUENCE:0
SUMMARY:Meeting test
UID:84FCD93F048970D6CC2580F00071FF27
END:VEVENT
END:VCALENDAR

Code
PersonalStorage pst = null;
AppointmentLoadOptions apptLO;
Appointment calDoc;
MailMessage calMsg;
MapiMessage calMapiMsg;
FolderInfo calFolder;
MapiCalendar mapiCal;
License asposeLicense;

try {
String pathPSTFileStr = “c:\temp\testPST.pst”;
String testFile = “c:\temp\test.ics”;
…set License…
pst = PersonalStorage.create(pathPSTFileStr, 0);
apptLO = new AppointmentLoadOptions();
apptLO.setApplyLocalTZ(true);
calDoc = Appointment.load(testFile, apptLO);
calDoc.setMethod(AppointmentMethodType.Add);
calDoc.setStatus(AppointmentStatus.Confirmed);
calDoc.setMethod(AppointmentAction.Create);
calMsg = new MailMessage();
calMsg.addAlternateView(calDoc.requestApointment());
calMapiMsg = MapiMessage.fromMailMessage(calMsg); //error here
calFolder = pst.createPredefinedFolder(“Calendar”, StandardIpmFolder.Appointments);
mapiCal = (MapiCalendar)calMapiMsg.toMapiMessageItem();
calFolder.addMapiMessageItem(mapiCal);
}
catch(Exception e) {
System.out.println("Error : " + e.toString());
}
finally {
pst.dispose();
}

FYI it looks like we can set;

if (calDoc.getOrganizer()!=null) {
calMapiMsg.setReplyTo(calDoc.getOrganizer().getAddress());
}

but is there a better way?

Thanks

Hi Peter,


Thank you for writing to Aspose Support team.

Aspose.Email API is following the same approach as if you do by manually adding the ICS to the PST file. You can use the setReplyTo method to avoid this as you have identified.