win32com MSProject find value and related Unique ID

Question:

writing python extension using win32com module to connect to MSProject. The tasks in the project have been ‘dispatched’ or not. If the task was not dispatched, the date is NULL. SO I iterate through the tasks and find those with ‘dispatch date’ == NULL, and place them in a temp list, easy.

local_temp_list = []
for task in MSProject.Tasks:
    if task['dispatch date'] == 'NULL':
        local_temp_list.append(task.UniqueID)

But how do I reference this task again, without having to iterate through all of them again? There seems to be no RowNumber attribute for tasks, how bizar!
And I also dont know how to look for the UniqueID and select that task, its a bit silly

Asked By: hewi

||

Answers:

Use the UniqueID property of the Tasks object to reference a task by its UID.

Try something like this:

for uid in local_temp_list:
    task = MSProject.Tasks.UniqueID(uid)
Answered By: Rachel Hettinger

What I was looking for was this functionality:

MSProject.application.find(Field="UniqueID", Test="equals", Value=uid)

which selects the current line of the task. From there, you ca go arbitrarily mad

Answered By: hewi
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.