Default Project Properties
Default Project Properties
Microsoft Project lets users set default project properties that speed up the process of setting up a project. The default properties define when a new task starts and finishes, sets the default overtime and standard pay rates and more. Aspose.Tasks for C++ supports these features.
The Project exposes a number of properties for managing a project’s default properties:
- DefaultStartTime: a new tasks’ default start time, takes a DateTime value.
- DefaultFinishTime: a new tasks’ default finishing time, takes a DateTime value.
- DefaultFixedCostAccrual: an assignment’s default fixed cost accrual, takes one of the values defined by the CostAccrualType enumeration.
- DefaultStandardRate: the default standard pay rate, takes a double.
- DefaultOvertimeRate: the default overtime pay rate, takes a double.
- DefaultTaskEVMethod: the default task earned value method, takes one of the values defined by the EarnedValueMethodType enumeration.
- DefaultTaskType: the project’s default task type, takes one of the values defined by the TaskType enumeration.
To see the default project information in Microsoft Project:
- Open a project.
- On the Tools menu, click Options.
- Go to the General tab. Here, you can see the settings for the default standard and overtime rates.
- Go to the Schedule tab. Here, you can see the settings for the default task type and default task start time.
Default project information in Microsoft Project, as written by Aspose.Tasks
Reading Default Properties
The code example given below demonstrates how to read a project’s default properties and writes them to a console window.
1// The path to the documents directory.
2System::String dataDir = RunExamples::GetDataDir(System::Reflection::MethodBase::GetCurrentMethod(ASPOSE_CURRENT_FUNCTION)->get_DeclaringType().get_FullName());
3
4// Create project
5System::SharedPtr<Project> project = System::MakeObject<Project>(dataDir + u"DefaultProperties.mpp");
6
7// Display default properties
8System::Console::WriteLine(System::String(u"New Task Default Start: ") + project->Get<System::DateTime>(Prj::DefaultStartTime()).ToShortDateString());
9System::Console::WriteLine(System::String(u"New Task Default Type: ") + System::ObjectExt::ToString(project->Get<TaskType>(Prj::DefaultTaskType())));
10System::Console::WriteLine(System::String(u"Resouce Default Standard Rate: ") + System::Convert::ToString(project->Get<double>(Prj::DefaultStandardRate())));
11System::Console::WriteLine(System::String(u"Resource Default Overtime Rate: ") + System::Convert::ToString(project->Get<double>(Prj::DefaultOvertimeRate())));
12System::Console::WriteLine(System::String(u"Default Task EV Method: ") + System::ObjectExt::ToString(project->Get<EarnedValueMethodType>(Prj::DefaultTaskEVMethod())));
13System::Console::WriteLine(System::String(u"Default Cost Accrual: ") + System::ObjectExt::ToString(project->Get<CostAccrualType>(Prj::DefaultFixedCostAccrual())));
Writing Default Properties
The code example given below demonstrates how to set a project’s default properties.
1// The path to the documents directory.
2System::String dataDir = RunExamples::GetDataDir(System::Reflection::MethodBase::GetCurrentMethod(ASPOSE_CURRENT_FUNCTION)->get_DeclaringType().get_FullName());
3
4// Create a project instance and Set default properties
5System::SharedPtr<Project> project = System::MakeObject<Project>();
6project->Set<NullableBool>(Prj::ScheduleFromStart(), NullableBool::to_NullableBool(true));
7project->Set(Prj::StartDate(), System::DateTime::get_Now());
8project->Set(Prj::DefaultStartTime(), project->Get<System::DateTime>(Prj::StartDate()));
9project->Set<TaskType>(Prj::DefaultTaskType(), Aspose::Tasks::TaskType::FixedDuration);
10project->Set<double>(Prj::DefaultStandardRate(), 15.0);
11project->Set<double>(Prj::DefaultOvertimeRate(), 12.0);
12project->Set<EarnedValueMethodType>(Prj::DefaultTaskEVMethod(), Aspose::Tasks::EarnedValueMethodType::PercentComplete);
13project->Set<CostAccrualType>(Prj::DefaultFixedCostAccrual(), Aspose::Tasks::CostAccrualType::Prorated);
14
15// Save the project to XML format
16project->Save(dataDir + u"WriteDefaultProperties_out.xml", Aspose::Tasks::Saving::SaveFileFormat::XML);