Reading Sub projects from MS Project Server

Am trying to read a project from Microsoft Project Server 2016, which has a sub project.

Loading the project as mentioned in

While reading the sub project task, Tsk.IsSubproject is coming as false and also has zero children.
Can you please confirm whether reading Projects with Subprojects from MS Project server is supported.

To reproduce the issue, please create two projects in the Server and make one as SubProject of other and try to read the project details from server.

Thank you,
RajeshKumar R.V.

@Rajeshrv

While reading the sub project task, Tsk.IsSubproject shall be false for the tasks of sub-project but for the task where the sub-project is inserted it shall be true.
For more clarification, please run this code sample for your project:

Project prj = new Project(settings);

// Create a ChildTasksCollector instance
ChildTasksCollector collector = new ChildTasksCollector();

// Collect all the tasks from RootTask using TaskUtils
TaskUtils.Apply(prj.RootTask, collector, 0);

// Parse through all the collected tasks
foreach (Task tsk in collector.Tasks)
{
    Console.WriteLine("Task Id: {0}", tsk.Get(Tsk.Id));
    Console.WriteLine("Task Uid: {0}", tsk.Get(Tsk.Uid));
    Console.WriteLine("Task Name: {0}", tsk.Get(Tsk.Name));
    Console.WriteLine("Is Subproject: {0}", tsk.Get(Tsk.IsSubproject));
    Console.WriteLine("Task Start: {0}", tsk.Get(Tsk.Start));
    Console.WriteLine("Task Finish: {0}", tsk.Get(Tsk.Finish));
}

Thanks for your reply.

The above solution is working if I try to read MPP project using MPP file, but if I try to read the project from Project Server 2016 I was able to read the subproject as Task, but that tasks fetches zero children. More over the flag IsSubProject on that task reads as false. This behavior is not specific to a project file from Project Server, if I try to read any project with type 6 (MasterProject) am having similar behavior.

@Rajeshrv

Thank you for your feedback.
We have logged this issue with ID “TASKSNET-2732” for further investigation. You will automatically be informed here once we have more information to share.

Team, can you please confirm on TASKNET-2732, so that we could plan our features for next release accordingly.

Thank you.

@Rajeshrv

Thank you for writing back to us.
We are working on this issue and it shall be a part of Aspose.Task for .NET 19.1 which shall be available in Jan 19.

The issues you have found earlier (filed as TASKSNET-2732) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan

Hi Team,
I was just trying to using this version 18.12 and when i try to read project using below code :

SqlConnectionStringBuilder sqlConnectionString = new SqlConnectionStringBuilder
{
DataSource = oSelDataCon.DbDataSource,
Encrypt = true,
TrustServerCertificate = true,
InitialCatalog = oSelDataCon.DbInitialCatalog,
NetworkLibrary = “DBMSSOCN”,
UserID = oSelDataCon.DbUsername,
Password = oSelDataCon.DbPassword
};
MspDbSettings oMsPDbSet = new MspDbSettings(sqlConnectionString.ConnectionString, new Guid(sCurrentMppProjId))
{
Schema = oSelDataCon.DbSchema
};
return new Project(oMsPDbSet);//Throws error here.

Throwing this error “Unable to cast object of type ‘System.Guid’ to type ‘System.String’.”
But if I switch back to 18.6 version things are fine.

@Rajeshrv

Thank you for writing back to us.
We have logged this issue with ID “TASKSNET-2898” for further investigation. You will automatically be informed here once we have more information to share.

@MuzammilKhan
Can you confirm when I can get this fix, we need to plan for our release accordingly.

Thank you.

@Rajeshrv

Thank you for writing back to us.

This issue has been resolved and will be a part of our next API release i.e. Aspose.Tasks for .NET 19.1.

@MuzammilKhan
Thanks for the update, please do confirm when could we expect the same.
Also do let me know if I could try any pre-release version of this some how.

@Rajeshrv

Thank you for writing back to us. Aspose.Tasks for .NET 19.1 shall probably be available at the end of next week.

The issues you have found earlier (filed as TASKSNET-2898) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan

Team,
Currently am checking the subjected behavior with 19.1/19.2 dll, and am seeing two different problems

Code :
SqlConnectionStringBuilder sqlConnectionString = new SqlConnectionStringBuilder
{
DataSource = oSelDataCon.DbDataSource,
Encrypt = true,
TrustServerCertificate = true,
InitialCatalog = oSelDataCon.DbInitialCatalog,
NetworkLibrary = “DBMSSOCN”,
UserID = oSelDataCon.DbUsername,
Password = oSelDataCon.DbPassword
};
MspDbSettings oMsPDbSet = new MspDbSettings(sqlConnectionString.ConnectionString, new Guid(sCurrentMppProjId))
{
Schema = oSelDataCon.DbSchema
};
return new Project(oMsPDbSet);//Throws error here.

  1. Throwing this error “System.ArgumentException: ‘An item with the same key has already been added.’"
  2. .Resources.GetByUid(iRscUid).Assignments ==> gives no assignment details its just empty.

Could you please check these issues.

@Rajeshrv

Thank you for your feedback.

We have logged this issue with ID “TASKSNET-3024” for further investigation. You will automatically be informed here once we have more information to share.

@Rajeshrv

We have investigated the issue and the exception is thrown and caught in Aspose.Tasks internal code, and you can examine such exceptions with “Break when thrown” (or similar) option enabled in IDE.

If the exception was not-handled, then you wouldn’t be able to examine “.Resources.GetByUid(iRscUid).Assignments” property.

Could you please confirm that the exception is “handled” and test application is not crashing? Secondly, can you please share stack trace/ log with us?

@MuzammilKhan
Stack trace shows this message " at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)"

AsposeTask_AssignmentErrorTrace.JPG (137.4 KB)

And this message is coming up for any project read from Project Server.

Thank you.

@Rajeshrv

Thank you for your feedback.

We have recorded the details and will consider it during the issue resolution. You will be update here once we have more information to share.

@Rajeshrv

It is requested to kindly confirm if “Call Stack” window in IDE has the similar content as shown in this image HandledException.png (73.6 KB) (the right bottom window) and if it the content is different then kindly share Call Stack with us.