Outlook task assignment

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

Hi,

Thank you for your inquiry.

Actually, the behavior is similar to Outlook. If you create a Task using Outlook and save it to disc using "Save As" method, it will create the task that is not in assignable form. However, to create one that is in assignable state, you can create a PST file and add the Task to it as shown in the following code sample. When the resultant PST is opened in MS Outlook, the task is in assignable state. Please try it at your end and share your feedback with us.

Code:


String pstFilePath = "AsposeEmails.pst";
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,


Thank you for sharing your feedback.

Could you please share with us how you managed to copy all the properties from the original MSG to the new? I was not able to figure out the necessary properties to achieve this. However, during saving the Task in TNEF EML format, I was able to observe the issue where the recepient/assignee was not retained. This specific issue has been logged as EMAILJAVA-33496 in our bug tracking system for investigation by our product team and we shall share our feedback with you once available.

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,


The issue seems strange as the properties count in the original as well as new task are the same. If we open the saved Task file in MFCMapi, the assignee address does exist in the TO field of the message. Since the issue has been logged as EMAILJAVA-33496, we shall share the product team’s feedback once available in this regard.

I already solved it by browsing the MAPI documentation.
The next problem is to set the ownership correctly.

Hi,


Could you please share the solution so that others can also benefit from it? Also, please share your problem details about the ownership of the task that you are facing so that we can investigate it at our end and assist you further.

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,


Thank you for writing back to us. Please feel free to write us in case you have any additional query in this regard.

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.