This gist shows code snippet on how to convert MPP to XER format using Aspose.Tasks Cloud SDK for .NET.
For more information, please visit
This gist shows code snippet on how to convert MPP to XER format using Aspose.Tasks Cloud SDK for .NET.
For more information, please visit
Code snippets for converting MPP to Oracle Prmavera P6 XER using Aspose.Tasks Cloud SDK For .NET |
// Get ClientID from https://dashboard.aspose.cloud/ | |
string clientSecret = "caac6e3d4a4724b2feb53f4e460eade3"; | |
string clientID = "4ccf1790-accc-41e9-8d18-a78dbb2ed1aa"; | |
// create a configuration object | |
var config = new Configuration{ AppSid= clientID, AppKey = clientSecret }; | |
// initialize Aspose.Tasks object | |
var tasksApi = new TasksApi(config); | |
String inputFile = "Home move plan.mpp"; | |
String resultant = "Output.xer"; | |
try | |
{ | |
// read the input MPP file from local storage | |
using (var inputStream = new FileStream("/Users/nshahbaz/Downloads/" + inputFile, FileMode.Open)) | |
{ | |
var uploadFileRequest = new PostCreateRequest(inputFile, inputStream); | |
// upload the file to cloud storage | |
tasksApi.UploadFile(uploadFileRequest); | |
} | |
// initialize the MPP to XER conversion process | |
var response = tasksApi.GetTaskDocumentWithFormat(new GetTaskDocumentWithFormatRequest | |
{ | |
Format = Aspose.Tasks.Cloud.Sdk.Model.ProjectFileFormat.Xer, | |
Name = inputFile, | |
Folder = null, | |
}); | |
if (response != null ) | |
{ | |
Console.WriteLine("Successfully converted MPP to XER !"); | |
} | |
// save the resultant file on local drive | |
saveToDisk(response, "/Users/nshahbaz/Downloads/" + resultant); | |
} | |
catch (Exception ex) | |
{ | |
Console.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); | |
} | |
public static void saveToDisk(Stream responseStream, String resultantFile) | |
{ | |
var fileStream = File.Create(resultantFile); | |
responseStream.Seek(0, SeekOrigin.Begin); | |
responseStream.CopyTo(fileStream); | |
fileStream.Close(); | |
} |