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:

To see the default project information in Microsoft Project:

  1. Open a project.
  2. On the Tools menu, click Options.
  3. Go to the General tab. Here, you can see the settings for the default standard and overtime rates.
  4. 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

show default project properties in Microsoft Project

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);
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.