Project

Project class

Represents a project.

public class Project

Constructors

Name Description
Project() Initializes a new instance of the Project class.
Project(DbSettings) Initializes a new instance of the Project class to read data from a database which is specified by the instance of the DbSettings class.
Project(Stream) Initializes a new instance of the Project class from a stream.
Project(StreamReader) Initializes a new instance of the Project class from a StreamReader instance.
Project(string) Initializes a new instance of the Project class from a template (existent mpp or mpt file).
Project(Stream, LoadOptions) Initializes a new instance of the Project class from the Stream with the specified instance of the LoadOptions class.
Project(Stream, ParseErrorCallback) Initializes a new instance of the Project class from a template(existent mpp or mpt file).
Project(Stream, PrimaveraReadOptions) Initializes a new instance of the Project class from the Stream with the specified instance of the PrimaveraReadOptions class.
Project(Stream, string) Initializes a new instance of the Project class from a template(existent mpp or mpt file).
Project(string, LoadOptions) Initializes a new instance of the Project class from a template (existent mpp or mpt file) with the specified instance of the LoadOptions class.
Project(string, ParseErrorCallback) Initializes a new instance of the Project class from a template (existent mpp or mpt file).
Project(string, PrimaveraReadOptions) Initializes a new instance of the Project class from a template (existent MPP or MPT file) with the specified instance of the PrimaveraReadOptions class.
Project(string, string) Initializes a new instance of the Project class from a password protected template (existent mpp or mpt file).

Properties

Name Description
BuiltInProps { get; } Gets project’s built-in properties collection.
CalculationMode { get; set; } Gets or sets calculation mode of a project. Can be one of the values of CalculationMode enumeration.
Calendars { get; } Gets CalendarCollection object of this Project instance.
CriticalPath { get; } Gets a collection which contains a list of Critical tasks which comprise Critical Path of this project. This is an O(n) operation, where n is the number of tasks in the project.
CustomProps { get; } Gets project’s custom properties collection.
DefaultView { get; set; } Gets or sets default view of the project.
DefaultWeekWorkingDays { get; } Gets the instance of WeekDayCollection class which represents a collection of project default week working days and working times.
DisplayOptions { get; } Gets an instance of the ProjectDisplayOptions class.
ExtendedAttributes { get; } Gets ExtendedAttributeDefinitionCollection object. The collection of extended attribute (custom fields) definitions associated with a project.
OleObjects { get; } Gets a collection containing the instances of the OleObject class which are linked or embedded to this project file. Available for mpp file format only. This collection is read-only except for ‘Clear’ operation.
OutlineCodes { get; } Gets OutlineCodeDefinitionCollection object. The collection of outline code definitions associated with a project.
ResourceAssignments { get; } Gets ResourceAssignmentCollection object.
ResourceFilters { get; } Gets all the resource-based filter definitions. ResourceFilters is a collection of Filter objects.
ResourceGroups { get; } Gets all of the resource-based group definitions. ResourceGroups is a collection of Group objects.
Resources { get; } Gets ResourceCollection object.
RootTask { get; } Gets the root of the tree of tasks.
Tables { get; } Gets a list of Table objects.
TaskFilters { get; } Gets all the task-based filter definitions. TaskFilters is a collection of Filter objects.
TaskGroups { get; } Gets all the task-based group definitions. TaskGroups is a collection of Group objects.
TaskLinks { get; } Gets TaskLinkCollection object.
VbaProject { get; } Gets an instance of VbaProject class.
Views { get; } Gets a list of View objects.
WBSCodeDefinition { get; set; } Gets or sets WBS Code Definition for the project.

Methods

Name Description
CopyTo(Project) Copies project’s main data and properties to another project.
CopyTo(Project, CopyToOptions) Copies project’s main data and properties to another project.
EnumerateAllChildTasks() Recursively enumerates all project’s tasks including root task.
Get<T>(Key<T, PrjKey>) Returns the value to which the property is mapped in this container.
GetBaselineSaveTime(BaselineType) Returns the baseline save time.
GetDuration(double) Gets Duration object with the specified number of units and default duration format which is defined in project’s settings DurationFormat.
GetDuration(double, TimeUnitType) Gets Duration object with the specified number of TimeUnitType units.
GetDuration(TimeSpan, TimeUnitType) Gets Duration object with the specified TimeSpan value and specified TimeUnitType value.
GetPageCount() Returns page count for the project to be rendered using default Timescale(Days).
GetPageCount(PresentationFormat) Returns page count for the project to be rendered using default Timescale(Days) and given PresentationFormat
GetPageCount(SaveOptions) Returns page count for the project to be rendered using given SaveOptions.
GetPageCount(Timescale) Returns page count for the project to be rendered using given Timescale.
GetPageCount(PageSize, Timescale) Returns page count for the project to be rendered using given Timescale and PageSize.
GetPageCount(PresentationFormat, Timescale) Returns page count for the project to be rendered using given Timescale and PresentationFormat.
GetPageCount(PageSize, Timescale, DateTime, DateTime) Returns page count for the project to be rendered using given Timescale, PresentationFormat and date range.
GetPredecessors(Task) Returns a collection of task links which are predecessors of the specified task.
GetWork(double) Gets Duration object with the specified Double value and default work format.
Print() Prints project to the default printer with default printer settings using the standard (no User Interface) print controller.
Print(PrinterSettings) Prints project according to the specified printer settings using the standard (no User Interface) print controller.
Print(PrintOptions) Prints project to the default printer with default printer settings and custom save options using the standard (no User Interface) print controller.
Print(string) Prints project to the specified printer with default printer settings using the standard (no User Interface) print controller.
Print(PrinterSettings, PrintOptions) Prints project according to the specified printer settings and custom save options using the standard (no User Interface) print controller.
Print(PrinterSettings, string) Prints project according to the specified printer settings using the standard (no User Interface) print controller.
Print(PrinterSettings, PrintOptions, string) Prints project according to the specified printer settings, custom save options and the specified document name using the standard (no User Interface) print controller.
Recalculate() Reschedules all project tasks ids, outline levels, start/finish dates, sets early/late dates, calculates slacks, work and cost fields.
Recalculate(bool) Reschedules all project tasks ids, outline levels, start/finish dates, sets early/late dates, calculates slacks, work and cost fields with optional validation.
RecalculateResourceFields() Recalculates Id, Start and Finish of resources.
RecalculateResourceStartFinish() Recalculates Start and Finish of resources.
RemoveInvalidResourceAssignments() Eliminates invalid resource assignments from the project resource assignments list.
RenumberWBSCode() Renumber WBS code of all tasks.
RenumberWBSCode(List<int>) Renumber WBS code of passed tasks.
RescheduleUncompletedWorkToStartAfter(DateTime) Reschedules uncompleted project work to start after a specified date.
RescheduleUncompletedWorkToStartAfter(DateTime, List<Task>) Reschedules uncompleted work for a specified list of tasks to start after a specified date.
Save(string) Saves the project data to the file in mpp format.
Save(Stream, MPPSaveOptions) Saves the project to a stream using the specified save options.
Save(Stream, SaveFileFormat) Saves the project data to the stream.
Save(Stream, SaveOptions) Saves the project to a stream using the specified save options.
Save(string, MPPSaveOptions) Saves the document to mpp file format using the specified save options.
Save(string, SaveFileFormat) Saves the project data to the file.
Save(string, SaveOptions) Saves the document to a file using the specified save options.
SaveAsTemplate(Stream) Saves the project as a template to a specified stream.
SaveAsTemplate(string) Saves the project as a template to the specified file path.
SaveAsTemplate(Stream, SaveTemplateOptions) Saves the project as a template to a specified stream.
SaveAsTemplate(string, SaveTemplateOptions) Saves the project as a template.
SaveReport(Stream) Saves the project overview report to the stream.
SaveReport(string) Saves the project overview report to PDF file.
SaveReport(Stream, ReportType) Saves the project report of the specified type to the specified stream.
SaveReport(string, ReportType) Saves the project report of the specified type in PDF format to the specified file path.
SelectAllChildTasks() Recursively collects all child tasks of the root task.
Set(Key<DateTime, PrjKey>, DateTime) Maps the specified property to the specified value in this container.
Set<T>(Key<T, PrjKey>, T) Maps the specified property to the specified value in this container.
SetBaseline(BaselineType) Saves baseline fields to the specified baseline for the entire project.
SetBaseline(BaselineType, IEnumerable<Task>) Saves baseline fields to the specified baseline for the selected tasks.
SetBaselineSaveTime(BaselineType, DateTime) Sets the baseline save time.
UpdateProjectWorkAsComplete(DateTime, bool) Updates all work as complete through a specified date for the entire project.
UpdateProjectWorkAsComplete(DateTime, bool, List<Task>) Updates all work as complete through a specified date for the specified list of tasks.
static GetProjectFileInfo(Stream) Gets project file info from the stream.
static GetProjectFileInfo(string) Read project file info from the file.

Remarks

The Project is a central class in the Aspose.Tasks library.

One can use Project to read one of supported project management formats: MPP, MPT, MPX, XML.

To load an existing document in any of the supported formats, pass a file name or a stream into one of the Project constructors. To create a blank project, call the parameterless constructor.

Use one of the Save method overloads to save the project in any of the SaveFileFormat formats: Primavera: P6 XML, PM XER; Microsoft Excel: XLSX, XML; Fixed Layout: PDF; Images: JPEG, PNG, BMP, TIFF, SVG; Text: TXT; Others: HTML.

To print the project, use one of the Print method overloads.

The Project stores project-wide information such as Views, BuiltInProps, CustomProps, and ExtendedAttributes. Most of these objects are accessible via the corresponding properties of the Project class.

The Project is a root entity that contains entry points to manipulate other project entities, such as Task, Resource, ResourceAssignment, ExtendedAttribute and Calendar.

The Project entities can be accessed via typed collections, for example Children, Resources, ResourceAssignments, etc.

See Also