Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/

API Reference

Class

ProjectDocument

Namespace OfficeIMO.Project
Assembly OfficeIMO.Project
Implements
IDisposable
Modifiers sealed

A typed Microsoft Project document. XML editing preserves source data and never implicitly schedules tasks.

Inheritance

  • Object
  • ProjectDocument

Usage

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters

Methods

public ProjectTask AddRecurringTask(String name, IEnumerable<DateTime> occurrenceStarts, ProjectDuration duration, ProjectTask parent = null, ProjectCalendar calendar = null, Int32 maxOccurrences = 10000, CancellationToken cancellationToken = default) #
Returns: ProjectTask

Adds a finite expanded recurring summary from strictly increasing local occurrence dates. Children use start-no-earlier-than constraints and the supplied duration; normal calendar scheduling determines their dates. XML retains the occurrences and recurring markers. Microsoft Project imports these as ordinary tasks and does not reconstruct an editable recurrence rule. Enumeration, cancellation, ownership and bounds are checked before adding any task.

Parameters

name System.String requiredposition: 0
occurrenceStarts System.Collections.Generic.IEnumerable{System.DateTime} requiredposition: 1
duration OfficeIMO.Project.ProjectDuration requiredposition: 2
parent OfficeIMO.Project.ProjectTask = null optionalposition: 3
calendar OfficeIMO.Project.ProjectCalendar = null optionalposition: 4
maxOccurrences System.Int32 = 10000 optionalposition: 5
cancellationToken System.Threading.CancellationToken = default optionalposition: 6
public ProjectAssignmentAnalysis AnalyzeAssignments(CancellationToken cancellationToken = default) #
Returns: ProjectAssignmentAnalysis

Analyzes stored assignment totals and uniform work/material costs without changing dates, actuals, rates, or source caches.

Parameters

cancellationToken System.Threading.CancellationToken = default optionalposition: 0
public ProjectEarnedValueResult AnalyzeEarnedValue(Int32 baselineNumber = 0, Nullable<DateTime> statusDate = null, Int32 maxCalendarDays = 36600, CancellationToken cancellationToken = default) #
Returns: ProjectEarnedValueResult

Evaluates stored baseline cost curves against independently recorded completion and actual costs. Does not schedule or mutate the project.

Parameters

baselineNumber System.Int32 = 0 optionalposition: 0
statusDate System.Nullable{System.DateTime} = null optionalposition: 1
maxCalendarDays System.Int32 = 36600 optionalposition: 2
cancellationToken System.Threading.CancellationToken = default optionalposition: 3
public ProjectResourceAllocationResult AnalyzeResourceAllocation(ProjectScheduleResult schedule, Int32 maxIntervals = 1000000, CancellationToken cancellationToken = default) #
Returns: ProjectResourceAllocationResult

Analyzes concurrent regular work against dated resource availability, without moving tasks or treating overtime as regular capacity.

Parameters

schedule OfficeIMO.Project.ProjectScheduleResult requiredposition: 0
maxIntervals System.Int32 = 1000000 optionalposition: 1
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
public ProjectResourcePoolResult AnalyzeResourcePool(IEnumerable<ProjectResourcePoolBinding> bindings, Int32 maxIntervals = 1000000, Int32 maxBindings = 10000, CancellationToken cancellationToken = default) #
Returns: ProjectResourcePoolResult

Combines explicitly mapped assignment demand against this pool's dated availability, without file access or mutation. Schedules use the same local time basis. Rates, calendars, and resource names are not synchronized; calculate each source first. Include the pool's own assignments through an explicit binding when they should contribute.

Parameters

bindings System.Collections.Generic.IEnumerable{OfficeIMO.Project.ProjectResourcePoolBinding} requiredposition: 0
maxIntervals System.Int32 = 1000000 optionalposition: 1
maxBindings System.Int32 = 10000 optionalposition: 2
cancellationToken System.Threading.CancellationToken = default optionalposition: 3
public Void ApplyCustomFields(ProjectCustomFieldCalculationResult result, CancellationToken cancellationToken = default) #
Returns: Void

Atomically applies a complete custom-field proposal to its unchanged originating document.

Parameters

result OfficeIMO.Project.ProjectCustomFieldCalculationResult requiredposition: 0
cancellationToken System.Threading.CancellationToken = default optionalposition: 1
public Void ApplyLeveling(ProjectLevelingResult result, CancellationToken cancellationToken = default) #
Returns: Void

Applies a complete leveling proposal to its unchanged originating document.

Parameters

result OfficeIMO.Project.ProjectLevelingResult requiredposition: 0
cancellationToken System.Threading.CancellationToken = default optionalposition: 1
public Void ApplySchedule(ProjectScheduleResult result, CancellationToken cancellationToken = default) #
Returns: Void

Applies an error-free schedule produced for this exact document revision, including assignment calculations when explicitly requested.

Parameters

result OfficeIMO.Project.ProjectScheduleResult requiredposition: 0
cancellationToken System.Threading.CancellationToken = default optionalposition: 1
AssessSave 2 overloads
public ProjectReport AssessSave(ProjectSaveOptions options = null, CancellationToken cancellationToken = default) #
Returns: ProjectReport

Assesses the current model for the selected format without committing output or calculating a schedule.

Parameters

options OfficeIMO.Project.ProjectSaveOptions = null optionalposition: 0
cancellationToken System.Threading.CancellationToken = default optionalposition: 1
public ProjectReport AssessSave(String path, ProjectSaveOptions options = null, CancellationToken cancellationToken = default) #
Returns: ProjectReport

Assesses a destination's format, including conversion loss, against the current model revision.

Parameters

path System.String requiredposition: 0
options OfficeIMO.Project.ProjectSaveOptions = null optionalposition: 1
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
public IDisposable BeginUpdate() #
Returns: IDisposable

Coalesces mutation revisions. This is not a rollback transaction and never calculates a schedule.

public ProjectCustomFieldCalculationResult CalculateCustomFields(ProjectCustomFieldCalculationOptions options = null, CancellationToken cancellationToken = default) #
Returns: ProjectCustomFieldCalculationResult

Evaluates supported task and resource formulas against stored model values. Calculate schedules first when formula inputs depend on changed dates, work, or cost.

Parameters

options OfficeIMO.Project.ProjectCustomFieldCalculationOptions = null optionalposition: 0
cancellationToken System.Threading.CancellationToken = default optionalposition: 1
public ProjectLevelingResult CalculateLeveling(ProjectLevelingOptions options = null, CancellationToken cancellationToken = default) #
Returns: ProjectLevelingResult

Proposes deterministic delays and optional remaining-work interruptions to resolve resource overloads. Preserves recorded actuals.

Parameters

options OfficeIMO.Project.ProjectLevelingOptions = null optionalposition: 0
cancellationToken System.Threading.CancellationToken = default optionalposition: 1
public ProjectScheduleResult CalculateSchedule(ProjectScheduleOptions options = null, CancellationToken cancellationToken = default) #
Returns: ProjectScheduleResult

Calculates a schedule without changing stored dates, actuals, costs, or source bytes. Unsupported combinations return diagnostics.

Parameters

options OfficeIMO.Project.ProjectScheduleOptions = null optionalposition: 0
cancellationToken System.Threading.CancellationToken = default optionalposition: 1
public Void CaptureBaseline(ProjectScheduleResult schedule, Int32 baselineNumber = 0, Boolean overwrite = false, Int32 maxIntervals = 1000000, CancellationToken cancellationToken = default) #
Returns: Void

Captures task, assignment and resource baseline totals and curves from a current calculated schedule. Existing baselines require explicit overwrite.

Parameters

schedule OfficeIMO.Project.ProjectScheduleResult requiredposition: 0
baselineNumber System.Int32 = 0 optionalposition: 1
overwrite System.Boolean = false optionalposition: 2
maxIntervals System.Int32 = 1000000 optionalposition: 3
cancellationToken System.Threading.CancellationToken = default optionalposition: 4
public ProjectDocument Clone(ProjectSaveOptions options = null, CancellationToken cancellationToken = default, ProjectLoadOptions loadOptions = null) #
Returns: ProjectDocument

Clones the current model through the selected format's validation and preservation contract, without an associated destination.

Parameters

options OfficeIMO.Project.ProjectSaveOptions = null optionalposition: 0
cancellationToken System.Threading.CancellationToken = default optionalposition: 1
loadOptions OfficeIMO.Project.ProjectLoadOptions = null optionalposition: 2
Create 3 overloads
public static ProjectDocument Create() #
Returns: ProjectDocument

Creates an in-memory document with deterministic working-time defaults, USD currency, and no implicit dates or calendar.

public static ProjectDocument Create(String path, DocumentCreateOptions options = null) #
Returns: ProjectDocument

Creates a document associated with an XML, MPP, or MPT path; creation does not write a file.

Parameters

arg1 System.String requiredposition: 0
arg2 OfficeIMO.DocumentCreateOptions = null optionalposition: 1
public static ProjectDocument Create(Stream stream, DocumentCreateOptions options = null) #
Returns: ProjectDocument

Creates a document associated with a caller-owned writable seekable stream.

Parameters

arg1 System.IO.Stream requiredposition: 0
arg2 OfficeIMO.DocumentCreateOptions = null optionalposition: 1
CreateFromTemplate 2 overloads
public static ProjectDocument CreateFromTemplate(String path, ProjectLoadOptions options = null, CancellationToken cancellationToken = default) #
Returns: ProjectDocument

Loads a document template into an unassociated editable project; saving cannot overwrite the template implicitly.

Parameters

path System.String requiredposition: 0
options OfficeIMO.Project.ProjectLoadOptions = null optionalposition: 1
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
public static ProjectDocument CreateFromTemplate(Stream stream, ProjectLoadOptions options = null, CancellationToken cancellationToken = default) #
Returns: ProjectDocument

Loads caller-owned template bytes into an unassociated editable project. The input is never rebound as the save destination.

Parameters

stream System.IO.Stream requiredposition: 0
options OfficeIMO.Project.ProjectLoadOptions = null optionalposition: 1
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
public ProjectView CreateView(ProjectScheduleResult schedule, ProjectViewOptions options = null, CancellationToken cancellationToken = default) #
Returns: ProjectView

Captures a portable report from a current schedule without changing stored dates or native presentation data.

Parameters

schedule OfficeIMO.Project.ProjectScheduleResult requiredposition: 0
options OfficeIMO.Project.ProjectViewOptions = null optionalposition: 1
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
public virtual Void Dispose() #
Returns: Void

Disposes the document. Caller-owned streams remain open. Explicit persistence is the default.

public ProjectIndicatorResult EvaluateIndicators(ProjectCustomFieldEntityKind entityKind, IEnumerable<ProjectIndicatorRule> rules, Boolean includeSummaries = true, ProjectCustomFieldCalculationOptions options = null, CancellationToken cancellationToken = default) #
Returns: ProjectIndicatorResult

Evaluates ordered caller-supplied graphical rules without mutation. The first true predicate selects the icon and accessible label. Uses stored built-in values and the custom-field calculator; it neither reads nor writes opaque native graphical-indicator definitions. MaxValues bounds both returned entities and total predicate evaluations. At most 1000 rules are accepted.

Parameters

entityKind OfficeIMO.Project.ProjectCustomFieldEntityKind requiredposition: 0
rules System.Collections.Generic.IEnumerable{OfficeIMO.Project.ProjectIndicatorRule} requiredposition: 1
includeSummaries System.Boolean = true optionalposition: 2
options OfficeIMO.Project.ProjectCustomFieldCalculationOptions = null optionalposition: 3
cancellationToken System.Threading.CancellationToken = default optionalposition: 4
public ProjectDataExportResult ExportTables(Boolean allowLossyProjection = false, Int32 maxRows = 100000, Int32 maxCells = 2000000, CancellationToken cancellationToken = default) #
Returns: ProjectDataExportResult

Projects stored task/resource/assignment/calendar fields into four mapped tables. This deliberately omits dependencies, advanced scheduling data and native/source payloads; inspect Notices before using it as an interchange format.

Parameters

allowLossyProjection System.Boolean = false optionalposition: 0
maxRows System.Int32 = 100000 optionalposition: 1
maxCells System.Int32 = 2000000 optionalposition: 2
cancellationToken System.Threading.CancellationToken = default optionalposition: 3
public ProjectOutlineCodeDefinition GetCustomFieldLookupTable(ProjectCustomFieldDefinition definition) #
Returns: ProjectOutlineCodeDefinition

Returns a field's shared lookup table selected by Ltuid; null means the field uses no shared table.

Parameters

definition OfficeIMO.Project.ProjectCustomFieldDefinition requiredposition: 0
public String GetOutlineCodeText(ProjectEntity entity, String fieldId) #
Returns: String

Resolves a task or resource outline-code selection to its masked hierarchical text; returns null when unassigned.

Parameters

entity OfficeIMO.Project.ProjectEntity requiredposition: 0
fieldId System.String requiredposition: 1
public static ProjectDataImportResult ImportTables(IEnumerable<ProjectMappedTable> tables, ProjectDataImportOptions options = null, CancellationToken cancellationToken = default) #
Returns: ProjectDataImportResult

Imports explicitly mapped tables into a new document, preserving UIDs. Duplicate identities, missing required values, cycles, malformed values and dangling references reject the entire import.

Parameters

tables System.Collections.Generic.IEnumerable{OfficeIMO.Project.ProjectMappedTable} requiredposition: 0
options OfficeIMO.Project.ProjectDataImportOptions = null optionalposition: 1
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
Load 2 overloads
public static ProjectDocument Load(String path, ProjectLoadOptions options = null, CancellationToken cancellationToken = default) #
Returns: ProjectDocument

Loads bounded XML or a qualified MPP14 document without calculating its schedule.

Parameters

path System.String requiredposition: 0
options OfficeIMO.Project.ProjectLoadOptions = null optionalposition: 1
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
public static ProjectDocument Load(Stream stream, ProjectLoadOptions options = null, CancellationToken cancellationToken = default) #
Returns: ProjectDocument

Loads a caller-owned stream. Seekable input is read from the start and its position is restored.

Parameters

stream System.IO.Stream requiredposition: 0
options OfficeIMO.Project.ProjectLoadOptions = null optionalposition: 1
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
LoadAsync 2 overloads
public static async Task<ProjectDocument> LoadAsync(String path, ProjectLoadOptions options = null, CancellationToken cancellationToken = default) #
Returns: Task<ProjectDocument>

Asynchronously reads a file, then parses XML or qualified native input with cancellation and structural limits.

Parameters

path System.String requiredposition: 0
options OfficeIMO.Project.ProjectLoadOptions = null optionalposition: 1
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
public static async Task<ProjectDocument> LoadAsync(Stream stream, ProjectLoadOptions options = null, CancellationToken cancellationToken = default) #
Returns: Task<ProjectDocument>

Asynchronously reads caller-owned input while preserving seekable stream position.

Parameters

stream System.IO.Stream requiredposition: 0
options OfficeIMO.Project.ProjectLoadOptions = null optionalposition: 1
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
public static ProjectDocument Parse(String xml, ProjectLoadOptions options = null, CancellationToken cancellationToken = default) #
Returns: ProjectDocument

Parses a Project XML string with bounded, DTD-disabled parsing.

Parameters

xml System.String requiredposition: 0
options OfficeIMO.Project.ProjectLoadOptions = null optionalposition: 1
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
public ProjectScheduleResult Recalculate(ProjectScheduleOptions options = null, CancellationToken cancellationToken = default) #
Returns: ProjectScheduleResult

Calculates and explicitly applies task dates. Throws before mutation when calculation reports errors.

Parameters

options OfficeIMO.Project.ProjectScheduleOptions = null optionalposition: 0
cancellationToken System.Threading.CancellationToken = default optionalposition: 1
Save 3 overloads
public Void Save(ProjectSaveOptions options = null, CancellationToken cancellationToken = default) #
Returns: Void

Saves to the associated file or seekable stream.

Parameters

options OfficeIMO.Project.ProjectSaveOptions = null optionalposition: 0
cancellationToken System.Threading.CancellationToken = default optionalposition: 1
public Void Save(String path, ProjectSaveOptions options = null, CancellationToken cancellationToken = default) #
Returns: Void

Atomically saves to the format selected by the extension and associates the document with that path after success.

Parameters

path System.String requiredposition: 0
options OfficeIMO.Project.ProjectSaveOptions = null optionalposition: 1
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
public Void Save(Stream stream, ProjectSaveOptions options = null, CancellationToken cancellationToken = default) #
Returns: Void

Saves to a caller-owned stream. Seekable streams are replaced; non-seekable streams receive bytes at their current position.

Parameters

stream System.IO.Stream requiredposition: 0
options OfficeIMO.Project.ProjectSaveOptions = null optionalposition: 1
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
SaveAsync 2 overloads
public async Task SaveAsync(String path, ProjectSaveOptions options = null, CancellationToken cancellationToken = default) #
Returns: Task

Asynchronously commits a complete Project file after validation and serialization.

Parameters

path System.String requiredposition: 0
options OfficeIMO.Project.ProjectSaveOptions = null optionalposition: 1
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
public async Task SaveAsync(Stream stream, ProjectSaveOptions options = null, CancellationToken cancellationToken = default) #
Returns: Task

Asynchronously writes the selected format to a caller-owned stream without replacing an existing destination association; failure may leave a partial destination.

Parameters

stream System.IO.Stream requiredposition: 0
options OfficeIMO.Project.ProjectSaveOptions = null optionalposition: 1
cancellationToken System.Threading.CancellationToken = default optionalposition: 2
SetCustomFieldLookupValue 2 overloads
public Void SetCustomFieldLookupValue(ProjectEntity entity, ProjectCustomFieldDefinition definition, ProjectOutlineCodeLookupValue lookup) #
Returns: Void

Assigns a flat shared lookup entry to a scalar task or resource field, retaining its value and identity.

Parameters

entity OfficeIMO.Project.ProjectEntity requiredposition: 0
definition OfficeIMO.Project.ProjectCustomFieldDefinition requiredposition: 1
lookup OfficeIMO.Project.ProjectOutlineCodeLookupValue requiredposition: 2
public Void SetCustomFieldLookupValue(ProjectEntity entity, ProjectCustomFieldDefinition definition, ProjectLookupValue lookup) #
Returns: Void

Assigns a modeled lookup entry to a qualified scalar task or resource field, retaining its value and lookup identity.

Parameters

entity OfficeIMO.Project.ProjectEntity requiredposition: 0
definition OfficeIMO.Project.ProjectCustomFieldDefinition requiredposition: 1
lookup OfficeIMO.Project.ProjectLookupValue requiredposition: 2
public Void SetOutlineCodeValue(ProjectEntity entity, String fieldId, ProjectOutlineCodeLookupValue value) #
Returns: Void

Assigns a hierarchical lookup value to a task or resource outline-code field, validating masks and selection restrictions before mutation.

Parameters

entity OfficeIMO.Project.ProjectEntity requiredposition: 0
fieldId System.String requiredposition: 1
value OfficeIMO.Project.ProjectOutlineCodeLookupValue requiredposition: 2
public String ToXml(ProjectSaveOptions options = null, CancellationToken cancellationToken = default) #
Returns: String

Serializes to XML text; no destination is rebound and the document remains modified.

Parameters

options OfficeIMO.Project.ProjectSaveOptions = null optionalposition: 0
cancellationToken System.Threading.CancellationToken = default optionalposition: 1
public ProjectReport Validate(CancellationToken cancellationToken = default) #
Returns: ProjectReport

Validates identities, relationships, values, and preservation risk without calculating or writing.

Parameters

cancellationToken System.Threading.CancellationToken = default optionalposition: 0

Properties

public ProjectNativeInfo NativeInfo { get; } #

Native source generation and inert container inventory; null for XML/new documents.

public String Name { get; set; } #

Project name, separate from the associated file path.

public String Title { get; set; } #

Document title.

public String Author { get; set; } #

Document author. No machine identity is supplied automatically.

public String Subject { get; set; } #

Document subject.

public String Company { get; set; } #

Organization metadata.

public String Manager { get; set; } #

Project manager metadata.

public Nullable<Guid> Guid { get; set; } #

Optional project GUID.

public ProjectSettings Settings { get; } #

Document settings and project calendar reference.

public ProjectCalendar Calendar { get; set; } #

Convenience access to the project's explicit calendar.

public ProjectTaskCollection Tasks { get; } #

Top-level tasks in outline order. Use AllTasks for a flat traversal.

public IEnumerable<ProjectTask> AllTasks { get; } #

All tasks in outline order, including project summaries and placeholders from source.

public ProjectResourceCollection Resources { get; } #

Resources.

public ProjectCalendarCollection Calendars { get; } #

Base and derived calendars.

public ProjectAssignmentCollection Assignments { get; } #

Task-resource assignments.

public ProjectDependencyCollection Dependencies { get; } #

Predecessor relationships.

public ProjectCollection<ProjectCustomFieldDefinition> CustomFields { get; } #

Project-wide custom-field definitions.

public ProjectCollection<ProjectOutlineCodeDefinition> OutlineCodes { get; } #

Hierarchical lookup tables and masks referenced by outline-code fields.

public Int64 Revision { get; set; } #

Current mutation revision; no calculation is implied.

public Boolean IsModified { get; } #

True when edits have not been saved to an associated destination.

public Boolean IsScheduleStale { get; set; } #

True when schedule-affecting changes have been made without an explicit calculation.

public Boolean AreWorkCostTotalsStale { get; set; } #

True after edits that can affect stored work/cost totals. Applying task dates does not recalculate those totals.

public Nullable<Int32> SourceSaveVersion { get; } #

The input's SaveVersion, if declared. This is not an MPP write capability.

public String XmlNamespace { get; } #

Source XML namespace, or the native Project XML namespace for a new document.

public IReadOnlyList<ProjectDiagnostic> ReadDiagnostics { get; } #

Findings collected during input parsing, without exposing mutable XML.

Extension Methods

public static ProjectFluentDocument AsFluent(ProjectDocument document) #
Returns: ProjectFluentDocument

Begins a fluent configuration session with local, explicit task/resource aliases.

Parameters

document OfficeIMO.Project.ProjectDocument requiredposition: 0