Search code examples
pythonwin32comms-project

win32com MSProject find value and related Unique ID


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


Solution

  • 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)