Dear Aspose support,
I’m trying to create a Task assignment with your framework. Hence i want the task to be assignable to someone else.
However it seems like that there is not such a method which supports that. I’ve copied all properties of an exported Outlook task to a newly created one … and yet the assignment is not available.
Can you please elaborate what is the right way to do this?
Thanks
Thank you for your inquiry.
PersonalStorage pst = PersonalStorage.create(pstFilePath, FileFormatVersion.Unicode);
{
Calendar cal = Calendar.getInstance();
MapiTask task = new MapiTask("To Do", "Just click and type to add new tasks", cal.getTime(), cal.getTime().);
task.setPercentComplete(20);
task.setEstimatedEffort(2000);
task.setActualEffort(20);
task.setHistory(MapiTaskHistory.NoChanges);
task.setLastUpdate(cal.getTime());
task.getUsers().setOwner("Darius");
task.getUsers().setLastAssigner("Harkness");
task.getUsers().setLastDelegate("Harkness");
//must be
task.setState(MapiTaskState.NotAssigned);
FolderInfo taskFolder = pst.createPredefinedFolder("Tasks", StandardIpmFolder.Tasks);
taskFolder.addMapiMessageItem(task);
}
I do not think that is viable.
Either it has to be opened in Outlook (no Drag&Drop support). And after that even if i double click on the create Outlook task it says: “Cannot open this item. Errors have been detected in this file …”.
What i’ve found it yet is that your API is able to create Task Assignment…just yet i do not know which property is doing that.
What i’ve done so far. Create a valid Task assignment -> Export (Save As). Read the file into Java runtime -> Create a new MapiTask instance -> Copy all properties (probably just the Extended MAPI needed) -> Copy all NamedPropertyMapping -> Copy the mode.
The above attributes are mandatory.
Can you suggest how can i resolve extended MAPI properties like: 2148335680 or 2148597763. Simple MAPI can be resolved with MapiPropertyTag.getPropertyName() i know.
We need a simple solution for the custom. Briefly be able to generate a task (from our application) and assign it to somebody else as easy as possible.
Do you have any suggestions?
Hi,
Dear Muhammad,
Take a look at the following code snippet to copy all mandatories.
Code:
// Load a working Task request
MapiMessage msg = MapiMessage.fromFile(“Test.msg”);
MapiTask task = (MapiTask)msg.toMapiMessageItem();
// Create a brand new Task instance
MapiTask mytask = new MapiTask();
// Copy properties
for (Object obj : task.getProperties()) {
DictionaryEntry entry = (DictionaryEntry) obj;
mytask.getProperties().addItem(entry.getKey(), entry.getValue());
}
// Copy mapping
MapiNamedPropertyMappingStorage storage = task.getNamedPropertyMapping();
for (Object obj : storage.getProperties()) {
DictionaryEntry entry = (DictionaryEntry) obj;
mytask.getNamedPropertyMapping().getProperties().addItem(entry.getKey(), entry.getValue());
}
// Copy mode
mytask.setMode(task.getMode());
mytask.save("…CoolTask.msg", TaskSaveFormat.Msg);
// CoolTask.msg should be a working Task Request
I was able to identify the intersection which is necessary to set. But yet i do not know what are these…because i only see the MAPI property identifiers.
Hi,
I already solved it by browsing the MAPI documentation.
The next problem is to set the ownership correctly.
Hi,
Hey the problem is that the created task request cannot be sent in Outlook.
This is due to that the owner is not correctly set (according to Outlook).
When i want to send it. It says: “You cannot assign task “[Task name]” because you do not own it”.
What do you think?
Hi,
The MapiTask has MapiTaskUser which contains the Owner property. It can be used to set the owner of the task. Could you please try it at your end and let us know your feedback.
Code:
MapiTask task = new MapiTask("task owner", "t1", DateTime.Now.AddDays(1), DateTime.Now.AddDays(5));
task.Users.Owner = "User";
task.Save("625071\\OwnerTask.msg", TaskSaveFormat.Msg);
Never mind…i solved it. The problem was related to the State of the MapiTask. It has to be set to “not assigned” (MapiTaskState.NotAssigned).
Hi,
The issues you have found earlier (filed as EMAILJAVA-33496) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.