Search code examples
ms-projectaspose

How to Set/Get "Last Saved on" Information for a baseline using Aspose.Tasks


I want to export data and create MsProject File using Aspose.Tasks. I am able to export data from my local db to project file successfully but while exporting Baseline information I am not able to find how to set "Last Saved on" information for the baseline. I am using below code to create and set baseline.

         project.SetBaseline(BaselineType.Baseline, new Task[] { task });
         var baselineType=BaselineType.Baseline;
         TaskBaseline baseline = task.Baselines.FirstOrDefault(x => 
         x.BaselineNumber.Equals(baselineType));

        if (baseline != null)
        {
            if (!String.IsNullOrEmpty(baselineDto.Cost))
                baseline.Cost = Convert.ToDecimal(baselineDto.Cost);

        }

If Anyone has any idea how to Get/Set "Last Saved on" Information for a baseline, please share.

Thanks. Bhupesh


Solution

  • I have observed your requirements and like to inform that we can only get Last Saved information using Aspose.Tasks. I have shared following sample code. This will help you to achieve your requirements.

    var s = @"c:\test\baseline msp 2016.mpp"; Project p = new Project(s); 
    Console.WriteLine(p.GetBaselineSaveTime(BaselineType.Baseline));
    Console.WriteLine(p.GetBaselineSaveTime(BaselineType.Baseline1));
    Console.WriteLine(p.GetBaselineSaveTime(BaselineType.Baseline2));
    

    I am working as Support developer/ Evangelist at Aspose.