We're sorry AsposeCloud doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.cloud

How to Convert Project XML to Microsoft Project Plan (MPP) via Node.js SDK

I have as an input a “.xml” file that can be imported to MS Project as it’s based on the Project XML Schema. I now want to use Aspose to convert this file to MS Project via the Node SDK. What is the function that I have to call to do this?
Looking forward to your response!

Best
Lasse

@lasse.steffen

I have tested the XML to MPP conversion with my sample XML file, but not getting the expected results. We are investigating the issue. However, we will appreciate it if you please also share your sample XML file with us.

1 Like

Thanks for the swift response! What I did was convert an Mpp to XML via the Node SDK and then convert this XML back again to MPP.

I can’t attach the file here, as I don’t have the XML file anymore / can’t upload the MPP file because of the file format.

When can I expect this to work again?

@lasse.steffen

Thanks for your feedback. We have recently logged the ticket(TASKSCLOUD-635). We will share the update as soon as we made some significant progress toward its resolution.

Thanks for now! Is there any workaround right now?

@lasse.steffen

As soon as we complete the issue investigation, then we will be in a good position to share any workaround/Fix.

1 Like

@lasse.steffen

Thanks for your patience. You can use GetTaskDocumentWithFormat API method to convert Project XML to MPP in Node.js using Aspose.Tasks Cloud SDK for Node.js. Please check the following sample code. You can check other unit test examples from GitHub repo.

Convert Project XML to MPP in Node.js

const { TasksApi } = require("@asposecloud/aspose-tasks-cloud");
const { UploadFileRequest, GetTaskDocumentWithFormatRequest, ProjectFileFormat } = require("@asposecloud/aspose-tasks-cloud/dist/src/model/model");
var fs = require('fs');

// Please get your ClientId and Secret from https://dashboard.aspose.cloud.
const tasksApi = new TasksApi("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx", "xxxxxxxxxxxxxxx");

const fileName = "Homemoveplan.xml";
const optionalRemoteFolder = "tasksApp/";
const remotePath = optionalRemoteFolder + fileName;
const buffer = fs.readFileSync(fileName);

const uploadFileRequest = new UploadFileRequest();
uploadFileRequest.path = remotePath;
uploadFileRequest.file = buffer;

tasksApi.uploadFile(uploadFileRequest).then(async uploadResult => {    
const request = new GetTaskDocumentWithFormatRequest();
        request.name = fileName;
        request.folder = optionalRemoteFolder;
        request.format = ProjectFileFormat.Mpp;
        request.returnAsZipArchive = false;
        request.storage = "";
    
    try {
        const result = await tasksApi.getTaskDocumentWithFormat(request);
        const ws = fs.createWriteStream("Homemoveplan.mpp")
        ws.write(new Uint8Array(result.body.buffer));    
        console.log("Done. ");
    }
    catch(err){
        console.log("Error has been occurred: " + err.message);
    }
});

Can you please test these files

Testproject_export.mpp -> input file
test.xml -> converted to xml via cloud api (confirmed that it can be imported by MS Project)
test.mpp -> output of conversion (most tasks have disappeared)

So it feels still very broken or am I doing something wrong?

@lasse.steffen

Thanks for your feedback. It seems both MPP files have 49 tasks. We will appreciate it if you please highlight the difference between the two MPP files with some details/screenshots. It will help us to address the issue exactly.

When I open the test.mpp it just has 2 tasks, it’s also way smaller in size for me (1/5th of the original size, see attachment). Can you share a screenshot of how test.mpp looks for you?

image.png (5.1 KB)

@lasse.steffen

I have also checked the test.mpp project file in Microsoft Project without any issue. Please find the screenshot of Aspose.Total Viewer App. Please let us know some more details of the issue you are facing at your end.