Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

ProjectDocument

OfficeIMO.Project

Namespace
OfficeIMO.Project
Assembly
OfficeIMO.Project
Source revision
ba882f6b0d07 with working tree changes
Implements
IDisposable
Modifiers
sealed

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

Inheritance

  • object
  • ProjectDocument

Usage

Explore 16 API references to this type

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

Accepted by parameters 3

Methods

public ProjectTask AddRecurringTask(string name, IEnumerable<DateTime> occurrenceStarts, ProjectDuration duration, ProjectTask? parent = null, ProjectCalendar? calendar = null, int maxOccurrences = 10000, CancellationToken cancellationToken = default) #

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 string required
occurrenceStarts System.Collections.Generic.IEnumerable<System.DateTime> required
duration OfficeIMO.Project.ProjectDuration required
parent OfficeIMO.Project.ProjectTask? = null optional
calendar OfficeIMO.Project.ProjectCalendar? = null optional
maxOccurrences int = 10000 optional
cancellationToken System.Threading.CancellationToken = default optional
public ProjectAssignmentAnalysis AnalyzeAssignments(CancellationToken cancellationToken = default) #

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

Parameters

cancellationToken System.Threading.CancellationToken = default optional
public ProjectEarnedValueResult AnalyzeEarnedValue(int baselineNumber = 0, DateTime? statusDate = null, int maxCalendarDays = 36600, CancellationToken cancellationToken = default) #

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

Parameters

baselineNumber int = 0 optional
statusDate System.DateTime? = null optional
maxCalendarDays int = 36600 optional
cancellationToken System.Threading.CancellationToken = default optional
public ProjectResourceAllocationResult AnalyzeResourceAllocation(ProjectScheduleResult schedule, int maxIntervals = 1000000, CancellationToken cancellationToken = default) #

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

Parameters

schedule OfficeIMO.Project.ProjectScheduleResult required
maxIntervals int = 1000000 optional
cancellationToken System.Threading.CancellationToken = default optional
public ProjectResourcePoolResult AnalyzeResourcePool(IEnumerable<ProjectResourcePoolBinding> bindings, int maxIntervals = 1000000, int maxBindings = 10000, CancellationToken cancellationToken = default) #

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> required
maxIntervals int = 1000000 optional
maxBindings int = 10000 optional
cancellationToken System.Threading.CancellationToken = default optional
public void ApplyCustomFields(ProjectCustomFieldCalculationResult result, CancellationToken cancellationToken = default) #

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

Parameters

result OfficeIMO.Project.ProjectCustomFieldCalculationResult required
cancellationToken System.Threading.CancellationToken = default optional
public void ApplyLeveling(ProjectLevelingResult result, CancellationToken cancellationToken = default) #

Applies a complete leveling proposal to its unchanged originating document.

Parameters

result OfficeIMO.Project.ProjectLevelingResult required
cancellationToken System.Threading.CancellationToken = default optional
public void ApplySchedule(ProjectScheduleResult result, CancellationToken cancellationToken = default) #

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

Parameters

result OfficeIMO.Project.ProjectScheduleResult required
cancellationToken System.Threading.CancellationToken = default optional
AssessSave 2 overloads
public ProjectReport AssessSave(ProjectSaveOptions? options = null, CancellationToken cancellationToken = default) #

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

Parameters

options OfficeIMO.Project.ProjectSaveOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public ProjectReport AssessSave(string path, ProjectSaveOptions? options = null, CancellationToken cancellationToken = default) #

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

Parameters

path string required
options OfficeIMO.Project.ProjectSaveOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public IDisposable BeginUpdate() #

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

Returns

IDisposable
public ProjectCustomFieldCalculationResult CalculateCustomFields(ProjectCustomFieldCalculationOptions? options = null, CancellationToken cancellationToken = default) #

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 optional
cancellationToken System.Threading.CancellationToken = default optional
public ProjectLevelingResult CalculateLeveling(ProjectLevelingOptions? options = null, CancellationToken cancellationToken = default) #

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

Parameters

options OfficeIMO.Project.ProjectLevelingOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public ProjectScheduleResult CalculateSchedule(ProjectScheduleOptions? options = null, CancellationToken cancellationToken = default) #

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

Parameters

options OfficeIMO.Project.ProjectScheduleOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public void CaptureBaseline(ProjectScheduleResult schedule, int baselineNumber = 0, bool overwrite = false, int maxIntervals = 1000000, CancellationToken cancellationToken = default) #

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

Parameters

schedule OfficeIMO.Project.ProjectScheduleResult required
baselineNumber int = 0 optional
overwrite bool = false optional
maxIntervals int = 1000000 optional
cancellationToken System.Threading.CancellationToken = default optional
public ProjectDocument Clone(ProjectSaveOptions? options = null, CancellationToken cancellationToken = default, ProjectLoadOptions? loadOptions = null) #

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

Parameters

options OfficeIMO.Project.ProjectSaveOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
loadOptions OfficeIMO.Project.ProjectLoadOptions? = null optional
Create 3 overloads
public static ProjectDocument Create() #

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

public static ProjectDocument Create(string path, ProjectCreateOptions? options = null) #

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

Parameters

path string required
options OfficeIMO.Project.ProjectCreateOptions? = null optional
public static ProjectDocument Create(Stream stream, ProjectCreateOptions? options = null) #

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

Parameters

stream System.IO.Stream required
options OfficeIMO.Project.ProjectCreateOptions? = null optional
CreateFromTemplate 2 overloads
public static ProjectDocument CreateFromTemplate(string path, ProjectLoadOptions? options = null, CancellationToken cancellationToken = default) #

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

Parameters

path string required
options OfficeIMO.Project.ProjectLoadOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public static ProjectDocument CreateFromTemplate(Stream stream, ProjectLoadOptions? options = null, CancellationToken cancellationToken = default) #

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

Parameters

stream System.IO.Stream required
options OfficeIMO.Project.ProjectLoadOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public ProjectView CreateView(ProjectScheduleResult schedule, ProjectViewOptions? options = null, CancellationToken cancellationToken = default) #

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

Parameters

schedule OfficeIMO.Project.ProjectScheduleResult required
options OfficeIMO.Project.ProjectViewOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public void Dispose() #

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

public ProjectDocument End() #

Resolves pending aliases and returns the underlying document. No save or calculation occurs.

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

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 required
rules System.Collections.Generic.IEnumerable<OfficeIMO.Project.ProjectIndicatorRule> required
includeSummaries bool = true optional
options OfficeIMO.Project.ProjectCustomFieldCalculationOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public ProjectDataExportResult ExportTables(bool allowLossyProjection = false, int maxRows = 100000, int maxCells = 2000000, CancellationToken cancellationToken = default) #

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 bool = false optional
maxRows int = 100000 optional
maxCells int = 2000000 optional
cancellationToken System.Threading.CancellationToken = default optional
public ProjectOutlineCodeDefinition? GetCustomFieldLookupTable(ProjectCustomFieldDefinition definition) #

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

Parameters

definition OfficeIMO.Project.ProjectCustomFieldDefinition required
public string? GetOutlineCodeText(ProjectEntity entity, string fieldId) #

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

Parameters

entity OfficeIMO.Project.ProjectEntity required
fieldId string required

Returns

string?
public static ProjectDataImportResult ImportTables(IEnumerable<ProjectMappedTable> tables, ProjectDataImportOptions? options = null, CancellationToken cancellationToken = default) #

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> required
options OfficeIMO.Project.ProjectDataImportOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
Load 2 overloads
public static ProjectDocument Load(string path, ProjectLoadOptions? options = null, CancellationToken cancellationToken = default) #

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

Parameters

path string required
options OfficeIMO.Project.ProjectLoadOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public static ProjectDocument Load(Stream stream, ProjectLoadOptions? options = null, CancellationToken cancellationToken = default) #

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

Parameters

stream System.IO.Stream required
options OfficeIMO.Project.ProjectLoadOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
LoadAsync 2 overloads
public static async Task<ProjectDocument> LoadAsync(string path, ProjectLoadOptions? options = null, CancellationToken cancellationToken = default) #

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

Parameters

path string required
options OfficeIMO.Project.ProjectLoadOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task<ProjectDocument>
public static async Task<ProjectDocument> LoadAsync(Stream stream, ProjectLoadOptions? options = null, CancellationToken cancellationToken = default) #

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

Parameters

stream System.IO.Stream required
options OfficeIMO.Project.ProjectLoadOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task<ProjectDocument>
public void NormalizeDisplayIds() #

Assigns native display IDs in current outline/resource order, preserving reserved UID-zero rows.

public static ProjectDocument Parse(string xml, ProjectLoadOptions? options = null, CancellationToken cancellationToken = default) #

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

Parameters

xml string required
options OfficeIMO.Project.ProjectLoadOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public ProjectScheduleResult Recalculate(ProjectScheduleOptions? options = null, CancellationToken cancellationToken = default) #

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

Parameters

options OfficeIMO.Project.ProjectScheduleOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
Save 3 overloads
public void Save(ProjectSaveOptions? options = null, CancellationToken cancellationToken = default) #

Saves to the associated file or seekable stream.

Parameters

options OfficeIMO.Project.ProjectSaveOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public void Save(string path, ProjectSaveOptions? options = null, CancellationToken cancellationToken = default) #

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

Parameters

path string required
options OfficeIMO.Project.ProjectSaveOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public void Save(Stream stream, ProjectSaveOptions? options = null, CancellationToken cancellationToken = default) #

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

Parameters

stream System.IO.Stream required
options OfficeIMO.Project.ProjectSaveOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
SaveAsync 2 overloads
public async Task SaveAsync(string path, ProjectSaveOptions? options = null, CancellationToken cancellationToken = default) #

Asynchronously commits a complete Project file after validation and serialization.

Parameters

path string required
options OfficeIMO.Project.ProjectSaveOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task
public async Task SaveAsync(Stream stream, ProjectSaveOptions? options = null, CancellationToken cancellationToken = default) #

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 required
options OfficeIMO.Project.ProjectSaveOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task
SetCustomFieldLookupValue 2 overloads
public void SetCustomFieldLookupValue(ProjectEntity entity, ProjectCustomFieldDefinition definition, ProjectOutlineCodeLookupValue lookup) #

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

Parameters

entity OfficeIMO.Project.ProjectEntity required
definition OfficeIMO.Project.ProjectCustomFieldDefinition required
lookup OfficeIMO.Project.ProjectOutlineCodeLookupValue required
public void SetCustomFieldLookupValue(ProjectEntity entity, ProjectCustomFieldDefinition definition, ProjectLookupValue lookup) #

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

Parameters

entity OfficeIMO.Project.ProjectEntity required
definition OfficeIMO.Project.ProjectCustomFieldDefinition required
lookup OfficeIMO.Project.ProjectLookupValue required
public void SetOutlineCodeValue(ProjectEntity entity, string fieldId, ProjectOutlineCodeLookupValue value) #

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 required
fieldId string required
value OfficeIMO.Project.ProjectOutlineCodeLookupValue required
public ProjectDocument StandardWorkingWeek(string name = "Standard") #

Creates and assigns an explicit standard working-week calendar.

Parameters

name string = "Standard" optional
public ProjectDocument StartsOn(DateTime date) #

Sets the local start date and forward-scheduling input without running the scheduler.

Parameters

date System.DateTime required
public string ToXml(ProjectSaveOptions? options = null, CancellationToken cancellationToken = default) #

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

Parameters

options OfficeIMO.Project.ProjectSaveOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

string
public ProjectReport Validate(CancellationToken cancellationToken = default) #

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

Parameters

cancellationToken System.Threading.CancellationToken = default optional

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 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 long Revision { get; private set; } #

Current mutation revision; no calculation is implied.

public bool IsModified { get; } #

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

public bool IsScheduleStale { get; private set; } #

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

public bool AreWorkCostTotalsStale { get; private set; } #

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

public int? 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.