public static void Run()
{
try
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);
Project project = CreateTestProjectWithCustomField();
Task task = project.RootTask.Children.GetById(1);
// Set formula for extended attribute
ExtendedAttributeDefinition extendedAttributeDefinition1 = project.ExtendedAttributes[0];
extendedAttributeDefinition1.Alias = "Days from finish to deadline";
extendedAttributeDefinition1.Formula = "[Deadline] - [Finish]";
// Set Task Deadline and save project
Task task1 = project.RootTask.Children.GetById(1);
task.Set(Tsk.Deadline, new DateTime(2015, 3, 20, 17, 0, 0));
project.Save(dataDir + "project_UsingTasksAndResourceFields_out.mpp", SaveFileFormat.MPP);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http://www.aspose.com/purchase/default.aspx.");
}
}