none
Project and Subtask creation using PSI in VS2010 is possible RRS feed

  • General discussion

  • Hi,

    You can  insert to the subtask in the middle of the project dataset under the parent task

    For Example;

    You have following structure in the project dataset.

    OutlineLevel     Task Name                             TaskGUID
    --------------------------------------------------------------------------------------
        1                  Parent Task 1                        ParentGUID
        2                        SubSummaryTask 1                SubSummaryTaskGUID1
        2                        SubSummaryTask 2                SubSummaryTaskGUID2
        2                        SubSummaryTask 3                SubSummaryTaskGUID3

    and you have a new task and you want to insert under SubSummaryTask 2 as a named SubTask2_1 and OutlineLevel 3.

    SvcProject.ProjectDataSet.TaskRow subTask = projectDs.Task.NewTaskRow();
    subTask.PROJ_UID = projectUID;
    subTask.TASK_UID = Guid.NewGuid();
    subTask.TASK_NAME =
    "SubTask2_1";
    subTask.AddAfterTaskUID = SubSummaryTaskGUID2;  //New task set under this task  if AddPosition = 1 but Outline Level is still 2
    subTask.AddPosition = 1; 
    subTask.TASK_OUTLINE_LEVEL = 3;  // This property sets Outline Level 3
    projectDs.Task.AddTaskRow(subTask);

     

     Result :

    OutlineLevel     Task Name                             TaskGUID
    --------------------------------------------------------------------------------------
        1                  Parent Task 1                        ParentGUID
        2                        SubSummaryTask 1                SubSummaryTaskGUID1
        2                        SubSummaryTask 2                SubSummaryTaskGUID2
        3                                    SubTask2_1                               SubTask2_1_GUID
        2                        SubSummaryTask 3                SubSummaryTaskGUID3

    If you have a different methods for this please you can share with me

    Thanks    

     

     


    • Edited by MehmetKurt Friday, November 11, 2011 9:52 AM
    Friday, November 11, 2011 9:51 AM