I'm trying to create a graph with data from an MPP file using win32com.client to read the data. But after consulting Microsoft's documentation, I tried to start with a simple code.
import win32com.client
mppFileName = 'C:/python/test.mpp'
mpp = win32com.client.Dispatch("MSProject.Application")
mpp.visible = 0
mpp.FileOpen(mppFileName)
project = mpp.ActiveProject
ResourceList = project.Resources
assignments = project.Assignments
for resource in ResourceList:
if resource.Work != 0:
print(resource.Name, ' ', resource.Job)
mpp.FileClose(Save=0)
exit()
But this code generates an error on the assignments= line (Assignments is 'unknown'). Does anyone know the correct way to work with Assignments and TimeScaleValues objects? My goal is to create a graph with the amount of work assigned by week to each project resource.
projectdoesn't have anAssignmentsproperty, butresourcedoes, as per the documentation link you provide.assignments = resource.Assignmentsin the 'for' loop? The documentation is very clear: Assignments is a property of the Resource object (likeWork): learn.microsoft.com/en-us/office/vba/api/…