Free Support Forum -

How to select newly created ExtendedAttribute in MPP file (C# .NET)

I can able to create new extended attribute / custom field.

After opening newly created mpp, i can see template with old column headings only,

How to add new column to mpp template column headings which is newly created extended attribute / custom field immediately after creating new attribute.


Can you please share source mpp file so that we may further investigate to help you out.


PFA my empty mpp template - “BlankTemplateProject.mpp”, and i need to create new mpp file with sample data as per mpp file - “PSF MPP template sample for MSF.mpp”. (70.0 KB)

“PSF MPP template sample for MSF.mpp”. file contains some new customized columns , so i created those new columns uisng extendedattribute code and they are appearing in lookup i.e, in new columns dropdown.

but when i create new columns, those should be shown on column heading by default after saving file, which is not happening.

Please find my code sample,

        License lic = new License();

        Project project = new Project(@"C:\Ramya\MPP\Old\BlankTemplateProject.mpp");

        ExtendedAttributeDefinition myTextAttributeDefinition = project.ExtendedAttributes.GetById((int)ExtendedAttributeTask.Text1);

        // If the Custom field doesn't exist in Project, create it
        if (myTextAttributeDefinition == null)
            myTextAttributeDefinition = ExtendedAttributeDefinition.CreateTaskDefinition(ExtendedAttributeTask.Text1, "My text field");

        //Create a new task
        Aspose.Tasks.Task task = project.RootTask.Children.Add("Engagement Dates");
        ExtendedAttribute taskAttribute = myTextAttributeDefinition.CreateExtendedAttribute();
        taskAttribute.TextValue = "Engagement Text details";

        task.Set(Tsk.Start, new DateTime(2018, 3, 12));
        //task.Set(Tsk.Finish, new DateTime(2019, 4, 1));

        task.Set(Tsk.Duration, project.GetDuration(30, TimeUnitType.Day));            

        project.Save(@"C:\Ramya\MPP\New\SDM_NewMPP_WithSampleData.mpp", SaveFileFormat.MPP);


How to set Predecessors value?

It is readonly , but if i want to set new value how?


I have observed your requirements and suggest you to please visit following thread link for your more about working with extended attribute in MPP file.

Hello, ramyaakula.

Do you want to add columns for the added extended attribute to the view using code?
If so, you can modify your example in the following way:

project.DefaultView.Table.TableFields.Add(new TableField { Field = Field.TaskText1, Title = “Title of my text field”});
project.Save(@“C:\Ramya\MPP\New\SDM_NewMPP_WithSampleData.mpp”, new MPPSaveOptions { WriteViewData = true} );


I will check and update you.



Thanks in advance, i will try.


Thank You, it worked for me.