Could you please help with the following:
- Task (IPM.Task) /Task Request (IPM.TaskRequest) shows incorrect Message class (IPM.Note) when loaded from eml.
Please refer to the following code snippet:
public static void createAndSaveMapiTask(String dataDir) {
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone(“GMT”));
calendar.set(2016, Calendar.NOVEMBER, 1, 0, 0, 0);
Date startDate = calendar.getTime();
calendar.set(2016, Calendar.DECEMBER, 1);
Date endDate = calendar.getTime();
MapiTask task = new MapiTask(“To Do”, “Just click and type to add new task”, startDate, endDate);
task.setPercentComplete(20);
task.setEstimatedEffort(2000);
task.setActualEffort(20);
task.setHistory(MapiTaskHistory.Assigned);
task.getUsers().setOwner(“Darius”);
task.getUsers().setLastAssigner(“Harkness”);
task.getUsers().setLastDelegate(“Harkness”);
task.getUsers().setOwnership(MapiTaskOwnership.AssignersCopy);
String[] companies = { “company1”, “company2”, “company3” };
task.setCompanies(companies);
String[] categories = { “category1”, “category2”, “category3” };
task.setCategories(categories);
task.setMileage(“Some test mileage”);
task.setBilling(“Test billing information”);
task.getUsers().setDelegator(“Test Delegator”);
task.setSensitivity(MapiSensitivity.Personal);
task.setStatus(MapiTaskStatus.Complete);
task.save(dataDir + “MapiTask_out.msg”, TaskSaveFormat.Msg);
}
@Test
public void testTaskMessage() throws Exception{
//create a task
createAndSaveMapiTask(msgDir);
//check Message Class of created task msg file
MapiMessage msg = MapiMessage.fromFile(msgDir+"MapiTask_out.msg");
assertEquals("IPM.Task", msg.getMessageClass()); //passes
//save task as eml
MsgLoadOptions msgLoadOptions = new MsgLoadOptions();
msgLoadOptions.setPreserveTnefAttachments(true);
MailMessage msg = MailMessage.load(msgDir+ MapiTask_out.msg", msgLoadOptions);
msg.save(msgDir + "MapiTask.eml");
//check Message Class of created task eml file
MapiMessage m = MapiMessage.fromMailMessage(msgDir+ "MapiTask.eml");
assertEquals("IPM.Task", m.getMessageClass()); //fails!! m.getMessageClass() returns IPM.Note
}
- Could you provide a code to create a “Task Request” using the Aspose library.