Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aspose-com-kb/2d0fa4aeba0a5ac6a9bc042bc99b4d49 to your computer and use it in GitHub Desktop.
Save aspose-com-kb/2d0fa4aeba0a5ac6a9bc042bc99b4d49 to your computer and use it in GitHub Desktop.
Extract Microsoft Project Metadata Information from .MPP File in C#. The step by step explanation can be found here: https://kb.aspose.com/tasks/net/how-to-extract-microsoft-project-file-metadata-in-c-sharp/
using System;
//Add reference to Aspose.Tasks for .NET API
//Use following namespaces to extract metadata from Micorosoft Project file
using Aspose.Tasks;
namespace ExtractMicrosoftProjectFileMetaData
{
class Program
{
static void Main(string[] args)
{
//Set Aspose license before extracting metadata from .MPP Project file
//using Aspose.Tasks for .NET
Aspose.Tasks.License AsposeTasksLicense = new Aspose.Tasks.License();
AsposeTasksLicense.SetLicense(@"c:\asposelicense\license.lic");
//creating an instance of Project class and loading .MPP file to read metadata
Project MicrosoftProjectFile = new Project("InputMicrosoftProjectFile.mpp");
//temporary string variables to hold metadata information
string ProjectAuthor,
ProjectCategory,
ProjectCompany,
ProjectComments;
//get each metadata property by property name as below
ProjectAuthor = MicrosoftProjectFile.Get(Prj.Author);
ProjectCategory = MicrosoftProjectFile.Get(Prj.Category);
ProjectCompany = MicrosoftProjectFile.Get(Prj.Company);
ProjectComments = MicrosoftProjectFile.Get(Prj.Comments);
//display the metadata information read from the Microsoft Project
Console.WriteLine("Author:{0}, Catgory:{1}, Company:{2}, Comments:{3}",
ProjectAuthor, ProjectCategory, ProjectCompany, ProjectComments);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment