Free Support Forum - aspose.com

Removing a task before saving

In my process I create task “groups”, in which I add tasks. After adding the tasks to this group I go back to see if this task actually have children (If aTask.ChildTasks.Count = 0).

How can I remove the group after I created them, I don’t see any methods for doing so. I normal situation I guess you would check for children before actually creating the group, but that requires too many database IO in our situation.

It seems that setting the task.id to 0 would at least hide the task, but it seems it is the parent that get hidden... quite weird...

Dear Desjardinsy,

Task id 0 reserved by MS for project summary task. It exists in any project.
You can make it visible:
Tools->Options->View->ShowProjectSummaryTask

Then how do I delete tasks that I just created?

Please check MpxCreate demo, MPXFile.AutoTaskID and MPXFile.AutoTaskUniqueID properties.

If you set this to true. Aspose.Project will generate all IDs automatically and will start from 1.

For deleting tasks use MPXFile.DeleteTaskByUniqueID function.
You can find short example in the Database demo.

Thank you! I don’t know why I didn’t think of checking at the File level to delete a task.