Writing Updated Resource Data to MPP

Aspose.Tasks for C++ API allows to update a Microsoft Project MPP file’s resource data and save it data back to the MPP file.

Writing Updated Resource Data back to the MPP file

The code snippet in this article opens a source MPP file that has one resource. It then updates the data of the resource and adds several new resources. The steps involved in this activity are:

  1. Create an instance of Project Reader.
  2. Read the source MPP file.
  3. Add resources to the project.
  4. Update existing resource data.
  5. Save the project using the Project Writer.

The following code example demonstrates how to write updated resource data back to the MPP.

 1// Create project instance
 2System::SharedPtr<Project> project1 = System::MakeObject<Project>(dataDir + u"UpdateResourceData.mpp");
 3        
 4// Add resource and set some properties
 5System::SharedPtr<Resource> rsc1 = project1->get_Resources()->Add(u"Rsc");
 6rsc1->Set<System::Decimal>(Rsc::StandardRate(), static_cast<System::Decimal>(30));
 7rsc1->Set<System::Decimal>(Rsc::OvertimeRate(), static_cast<System::Decimal>(45));
 8rsc1->Set<System::String>(Rsc::Group(), u"Workgroup1");
 9        
10// Save the Project
11project1->Save(dataDir + u"UpdateResourceData_out.mpp", Aspose::Tasks::Saving::SaveFileFormat::MPP);
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.