P
Paul
I am trying to create a datatable of task assignments in PSI. I am using C#,
Visual Studio 2008, and Microsoft Project Server 2007. The code sample I
have included below compiles perfectly and it seems to work until you go to
read the actual values in assignmentRow, and then you have problems. The
TASK_NAME and RES_NAME are both DBNull. Also If you try to open the
assignmentRow object in debug to see what is in there, you get Strong Type
Exception messages. Any ideas?
// Set up the Web service objects
ProjectWebSvc.Project projectSvc = new
ProjectWebSvc.Project();
projectSvc.Url = p_projectServerURI + p_projectServicePath;
projectSvc.Credentials = CredentialCache.DefaultCredentials;
ProjectWebSvc.ProjectDataSet projectDs =
projectSvc.ReadProjectEntities(projGUID, 2 | 4 | 8,
ProjectWebSvc.DataStoreEnum.WorkingStore);
ProjectWebSvc.ProjectDataSet.AssignmentDataTable
assignmentTable = projectDs.Assignment;
foreach (ProjectWebSvc.ProjectDataSet.AssignmentRow
assignmentRow in assignmentTable)
{
row = table.NewRow();
row["Act"] = assignmentRow.TASK_NAME;
row["Resource"] = assignmentRow.RES_NAME;
table.Rows.Add(row);
}
row and table are objects created earlier in the code, but they aren't the
problem. The problem is something to do with the way I am trying to read the
assignmentRow object.
Thanks!
Paul
Visual Studio 2008, and Microsoft Project Server 2007. The code sample I
have included below compiles perfectly and it seems to work until you go to
read the actual values in assignmentRow, and then you have problems. The
TASK_NAME and RES_NAME are both DBNull. Also If you try to open the
assignmentRow object in debug to see what is in there, you get Strong Type
Exception messages. Any ideas?
// Set up the Web service objects
ProjectWebSvc.Project projectSvc = new
ProjectWebSvc.Project();
projectSvc.Url = p_projectServerURI + p_projectServicePath;
projectSvc.Credentials = CredentialCache.DefaultCredentials;
ProjectWebSvc.ProjectDataSet projectDs =
projectSvc.ReadProjectEntities(projGUID, 2 | 4 | 8,
ProjectWebSvc.DataStoreEnum.WorkingStore);
ProjectWebSvc.ProjectDataSet.AssignmentDataTable
assignmentTable = projectDs.Assignment;
foreach (ProjectWebSvc.ProjectDataSet.AssignmentRow
assignmentRow in assignmentTable)
{
row = table.NewRow();
row["Act"] = assignmentRow.TASK_NAME;
row["Resource"] = assignmentRow.RES_NAME;
table.Rows.Add(row);
}
row and table are objects created earlier in the code, but they aren't the
problem. The problem is something to do with the way I am trying to read the
assignmentRow object.
Thanks!
Paul