API Reference
ProjectDocument
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.
Returned or exposed by
- Method ProjectFluentDocument.End
- Property ProjectDataImportResult.Document
- Method ProjectDocument.Clone
- Method ProjectDocument.Create
- Method ProjectDocument.Create
- Method ProjectDocument.Create
- Method ProjectDocument.CreateFromTemplate
- Method ProjectDocument.CreateFromTemplate
- Method ProjectDocument.Load
- Method ProjectDocument.Load
- Method ProjectDocument.LoadAsync
- Method ProjectDocument.LoadAsync
- Method ProjectDocument.Parse
- Method ProjectExternalProjectResolver.EndInvoke
- Method ProjectExternalProjectResolver.Invoke
- Property ProjectResourcePoolBinding.Project
Accepted by parameters
- Constructor ProjectFluentDocument.ProjectFluentDocument
- Method ProjectFluentExtensions.AsFluent
- Extension method ProjectDocument.AsFluent
- Method ProjectExternalProjectResolver.BeginInvoke
- Method ProjectExternalProjectResolver.Invoke
- Constructor ProjectResourcePoolBinding.ProjectResourcePoolBinding
Methods
public ProjectTask AddRecurringTask(String name, IEnumerable<DateTime> occurrenceStarts, ProjectDuration duration, ProjectTask parent = null, ProjectCalendar calendar = null, Int32 maxOccurrences = 10000, CancellationToken cancellationToken = default) #ProjectTaskAdds 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
- occurrenceStarts System.Collections.Generic.IEnumerable{System.DateTime}
- duration OfficeIMO.Project.ProjectDuration
- parent OfficeIMO.Project.ProjectTask = null
- calendar OfficeIMO.Project.ProjectCalendar = null
- maxOccurrences System.Int32 = 10000
- cancellationToken System.Threading.CancellationToken = default
public ProjectAssignmentAnalysis AnalyzeAssignments(CancellationToken cancellationToken = default) #ProjectAssignmentAnalysisAnalyzes stored assignment totals and uniform work/material costs without changing dates, actuals, rates, or source caches.
Parameters
- cancellationToken System.Threading.CancellationToken = default
public ProjectEarnedValueResult AnalyzeEarnedValue(Int32 baselineNumber = 0, Nullable<DateTime> statusDate = null, Int32 maxCalendarDays = 36600, CancellationToken cancellationToken = default) #ProjectEarnedValueResultEvaluates stored baseline cost curves against independently recorded completion and actual costs. Does not schedule or mutate the project.
Parameters
- baselineNumber System.Int32 = 0
- statusDate System.Nullable{System.DateTime} = null
- maxCalendarDays System.Int32 = 36600
- cancellationToken System.Threading.CancellationToken = default
public ProjectResourceAllocationResult AnalyzeResourceAllocation(ProjectScheduleResult schedule, Int32 maxIntervals = 1000000, CancellationToken cancellationToken = default) #ProjectResourceAllocationResultAnalyzes concurrent regular work against dated resource availability, without moving tasks or treating overtime as regular capacity.
Parameters
- schedule OfficeIMO.Project.ProjectScheduleResult
- maxIntervals System.Int32 = 1000000
- cancellationToken System.Threading.CancellationToken = default
public ProjectResourcePoolResult AnalyzeResourcePool(IEnumerable<ProjectResourcePoolBinding> bindings, Int32 maxIntervals = 1000000, Int32 maxBindings = 10000, CancellationToken cancellationToken = default) #ProjectResourcePoolResultCombines 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}
- maxIntervals System.Int32 = 1000000
- maxBindings System.Int32 = 10000
- cancellationToken System.Threading.CancellationToken = default
public Void ApplyCustomFields(ProjectCustomFieldCalculationResult result, CancellationToken cancellationToken = default) #VoidAtomically applies a complete custom-field proposal to its unchanged originating document.
Parameters
- result OfficeIMO.Project.ProjectCustomFieldCalculationResult
- cancellationToken System.Threading.CancellationToken = default
public Void ApplyLeveling(ProjectLevelingResult result, CancellationToken cancellationToken = default) #VoidApplies a complete leveling proposal to its unchanged originating document.
Parameters
- result OfficeIMO.Project.ProjectLevelingResult
- cancellationToken System.Threading.CancellationToken = default
public Void ApplySchedule(ProjectScheduleResult result, CancellationToken cancellationToken = default) #VoidApplies an error-free schedule produced for this exact document revision, including assignment calculations when explicitly requested.
Parameters
- result OfficeIMO.Project.ProjectScheduleResult
- cancellationToken System.Threading.CancellationToken = default
public ProjectReport AssessSave(ProjectSaveOptions options = null, CancellationToken cancellationToken = default) #ProjectReportAssesses the current model for the selected format without committing output or calculating a schedule.
Parameters
- options OfficeIMO.Project.ProjectSaveOptions = null
- cancellationToken System.Threading.CancellationToken = default
public ProjectReport AssessSave(String path, ProjectSaveOptions options = null, CancellationToken cancellationToken = default) #ProjectReportAssesses a destination's format, including conversion loss, against the current model revision.
Parameters
- path System.String
- options OfficeIMO.Project.ProjectSaveOptions = null
- cancellationToken System.Threading.CancellationToken = default
public IDisposable BeginUpdate() #IDisposableCoalesces mutation revisions. This is not a rollback transaction and never calculates a schedule.
public ProjectCustomFieldCalculationResult CalculateCustomFields(ProjectCustomFieldCalculationOptions options = null, CancellationToken cancellationToken = default) #ProjectCustomFieldCalculationResultEvaluates 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
- cancellationToken System.Threading.CancellationToken = default
public ProjectLevelingResult CalculateLeveling(ProjectLevelingOptions options = null, CancellationToken cancellationToken = default) #ProjectLevelingResultProposes deterministic delays and optional remaining-work interruptions to resolve resource overloads. Preserves recorded actuals.
Parameters
- options OfficeIMO.Project.ProjectLevelingOptions = null
- cancellationToken System.Threading.CancellationToken = default
public ProjectScheduleResult CalculateSchedule(ProjectScheduleOptions options = null, CancellationToken cancellationToken = default) #ProjectScheduleResultCalculates a schedule without changing stored dates, actuals, costs, or source bytes. Unsupported combinations return diagnostics.
Parameters
- options OfficeIMO.Project.ProjectScheduleOptions = null
- cancellationToken System.Threading.CancellationToken = default
public Void CaptureBaseline(ProjectScheduleResult schedule, Int32 baselineNumber = 0, Boolean overwrite = false, Int32 maxIntervals = 1000000, CancellationToken cancellationToken = default) #VoidCaptures task, assignment and resource baseline totals and curves from a current calculated schedule. Existing baselines require explicit overwrite.
Parameters
- schedule OfficeIMO.Project.ProjectScheduleResult
- baselineNumber System.Int32 = 0
- overwrite System.Boolean = false
- maxIntervals System.Int32 = 1000000
- cancellationToken System.Threading.CancellationToken = default
public ProjectDocument Clone(ProjectSaveOptions options = null, CancellationToken cancellationToken = default, ProjectLoadOptions loadOptions = null) #ProjectDocumentClones the current model through the selected format's validation and preservation contract, without an associated destination.
Parameters
- options OfficeIMO.Project.ProjectSaveOptions = null
- cancellationToken System.Threading.CancellationToken = default
- loadOptions OfficeIMO.Project.ProjectLoadOptions = null
public static ProjectDocument Create() #ProjectDocumentCreates 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) #ProjectDocumentCreates a document associated with an XML, MPP, or MPT path; creation does not write a file.
Parameters
- arg1 System.String
- arg2 OfficeIMO.DocumentCreateOptions = null
public static ProjectDocument Create(Stream stream, DocumentCreateOptions options = null) #ProjectDocumentCreates a document associated with a caller-owned writable seekable stream.
Parameters
- arg1 System.IO.Stream
- arg2 OfficeIMO.DocumentCreateOptions = null
public static ProjectDocument CreateFromTemplate(String path, ProjectLoadOptions options = null, CancellationToken cancellationToken = default) #ProjectDocumentLoads a document template into an unassociated editable project; saving cannot overwrite the template implicitly.
Parameters
- path System.String
- options OfficeIMO.Project.ProjectLoadOptions = null
- cancellationToken System.Threading.CancellationToken = default
public static ProjectDocument CreateFromTemplate(Stream stream, ProjectLoadOptions options = null, CancellationToken cancellationToken = default) #ProjectDocumentLoads caller-owned template bytes into an unassociated editable project. The input is never rebound as the save destination.
Parameters
- stream System.IO.Stream
- options OfficeIMO.Project.ProjectLoadOptions = null
- cancellationToken System.Threading.CancellationToken = default
public ProjectView CreateView(ProjectScheduleResult schedule, ProjectViewOptions options = null, CancellationToken cancellationToken = default) #ProjectViewCaptures a portable report from a current schedule without changing stored dates or native presentation data.
Parameters
- schedule OfficeIMO.Project.ProjectScheduleResult
- options OfficeIMO.Project.ProjectViewOptions = null
- cancellationToken System.Threading.CancellationToken = default
public virtual Void Dispose() #VoidDisposes 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) #ProjectIndicatorResultEvaluates 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
- rules System.Collections.Generic.IEnumerable{OfficeIMO.Project.ProjectIndicatorRule}
- includeSummaries System.Boolean = true
- options OfficeIMO.Project.ProjectCustomFieldCalculationOptions = null
- cancellationToken System.Threading.CancellationToken = default
public ProjectDataExportResult ExportTables(Boolean allowLossyProjection = false, Int32 maxRows = 100000, Int32 maxCells = 2000000, CancellationToken cancellationToken = default) #ProjectDataExportResultProjects 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
- maxRows System.Int32 = 100000
- maxCells System.Int32 = 2000000
- cancellationToken System.Threading.CancellationToken = default
public ProjectOutlineCodeDefinition GetCustomFieldLookupTable(ProjectCustomFieldDefinition definition) #ProjectOutlineCodeDefinitionReturns a field's shared lookup table selected by Ltuid; null means the field uses no shared table.
Parameters
- definition OfficeIMO.Project.ProjectCustomFieldDefinition
public String GetOutlineCodeText(ProjectEntity entity, String fieldId) #StringResolves a task or resource outline-code selection to its masked hierarchical text; returns null when unassigned.
Parameters
- entity OfficeIMO.Project.ProjectEntity
- fieldId System.String
public static ProjectDataImportResult ImportTables(IEnumerable<ProjectMappedTable> tables, ProjectDataImportOptions options = null, CancellationToken cancellationToken = default) #ProjectDataImportResultImports 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}
- options OfficeIMO.Project.ProjectDataImportOptions = null
- cancellationToken System.Threading.CancellationToken = default
public static ProjectDocument Load(String path, ProjectLoadOptions options = null, CancellationToken cancellationToken = default) #ProjectDocumentLoads bounded XML or a qualified MPP14 document without calculating its schedule.
Parameters
- path System.String
- options OfficeIMO.Project.ProjectLoadOptions = null
- cancellationToken System.Threading.CancellationToken = default
public static ProjectDocument Load(Stream stream, ProjectLoadOptions options = null, CancellationToken cancellationToken = default) #ProjectDocumentLoads a caller-owned stream. Seekable input is read from the start and its position is restored.
Parameters
- stream System.IO.Stream
- options OfficeIMO.Project.ProjectLoadOptions = null
- cancellationToken System.Threading.CancellationToken = default
public static async Task<ProjectDocument> LoadAsync(String path, ProjectLoadOptions options = null, CancellationToken cancellationToken = default) #Task<ProjectDocument>Asynchronously reads a file, then parses XML or qualified native input with cancellation and structural limits.
Parameters
- path System.String
- options OfficeIMO.Project.ProjectLoadOptions = null
- cancellationToken System.Threading.CancellationToken = default
public static async Task<ProjectDocument> LoadAsync(Stream stream, ProjectLoadOptions options = null, CancellationToken cancellationToken = default) #Task<ProjectDocument>Asynchronously reads caller-owned input while preserving seekable stream position.
Parameters
- stream System.IO.Stream
- options OfficeIMO.Project.ProjectLoadOptions = null
- cancellationToken System.Threading.CancellationToken = default
public static ProjectDocument Parse(String xml, ProjectLoadOptions options = null, CancellationToken cancellationToken = default) #ProjectDocumentParses a Project XML string with bounded, DTD-disabled parsing.
Parameters
- xml System.String
- options OfficeIMO.Project.ProjectLoadOptions = null
- cancellationToken System.Threading.CancellationToken = default
public ProjectScheduleResult Recalculate(ProjectScheduleOptions options = null, CancellationToken cancellationToken = default) #ProjectScheduleResultCalculates and explicitly applies task dates. Throws before mutation when calculation reports errors.
Parameters
- options OfficeIMO.Project.ProjectScheduleOptions = null
- cancellationToken System.Threading.CancellationToken = default
public Void Save(ProjectSaveOptions options = null, CancellationToken cancellationToken = default) #VoidSaves to the associated file or seekable stream.
Parameters
- options OfficeIMO.Project.ProjectSaveOptions = null
- cancellationToken System.Threading.CancellationToken = default
public Void Save(String path, ProjectSaveOptions options = null, CancellationToken cancellationToken = default) #VoidAtomically saves to the format selected by the extension and associates the document with that path after success.
Parameters
- path System.String
- options OfficeIMO.Project.ProjectSaveOptions = null
- cancellationToken System.Threading.CancellationToken = default
public Void Save(Stream stream, ProjectSaveOptions options = null, CancellationToken cancellationToken = default) #VoidSaves to a caller-owned stream. Seekable streams are replaced; non-seekable streams receive bytes at their current position.
Parameters
- stream System.IO.Stream
- options OfficeIMO.Project.ProjectSaveOptions = null
- cancellationToken System.Threading.CancellationToken = default
public async Task SaveAsync(String path, ProjectSaveOptions options = null, CancellationToken cancellationToken = default) #TaskAsynchronously commits a complete Project file after validation and serialization.
Parameters
- path System.String
- options OfficeIMO.Project.ProjectSaveOptions = null
- cancellationToken System.Threading.CancellationToken = default
public async Task SaveAsync(Stream stream, ProjectSaveOptions options = null, CancellationToken cancellationToken = default) #TaskAsynchronously 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
- options OfficeIMO.Project.ProjectSaveOptions = null
- cancellationToken System.Threading.CancellationToken = default
public Void SetCustomFieldLookupValue(ProjectEntity entity, ProjectCustomFieldDefinition definition, ProjectOutlineCodeLookupValue lookup) #VoidAssigns a flat shared lookup entry to a scalar task or resource field, retaining its value and identity.
Parameters
- entity OfficeIMO.Project.ProjectEntity
- definition OfficeIMO.Project.ProjectCustomFieldDefinition
- lookup OfficeIMO.Project.ProjectOutlineCodeLookupValue
public Void SetCustomFieldLookupValue(ProjectEntity entity, ProjectCustomFieldDefinition definition, ProjectLookupValue lookup) #VoidAssigns a modeled lookup entry to a qualified scalar task or resource field, retaining its value and lookup identity.
Parameters
- entity OfficeIMO.Project.ProjectEntity
- definition OfficeIMO.Project.ProjectCustomFieldDefinition
- lookup OfficeIMO.Project.ProjectLookupValue
public Void SetOutlineCodeValue(ProjectEntity entity, String fieldId, ProjectOutlineCodeLookupValue value) #VoidAssigns a hierarchical lookup value to a task or resource outline-code field, validating masks and selection restrictions before mutation.
Parameters
- entity OfficeIMO.Project.ProjectEntity
- fieldId System.String
- value OfficeIMO.Project.ProjectOutlineCodeLookupValue
public String ToXml(ProjectSaveOptions options = null, CancellationToken cancellationToken = default) #StringSerializes to XML text; no destination is rebound and the document remains modified.
Parameters
- options OfficeIMO.Project.ProjectSaveOptions = null
- cancellationToken System.Threading.CancellationToken = default
public ProjectReport Validate(CancellationToken cancellationToken = default) #ProjectReportValidates identities, relationships, values, and preservation risk without calculating or writing.
Parameters
- cancellationToken System.Threading.CancellationToken = default
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object
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) #ProjectFluentDocumentBegins a fluent configuration session with local, explicit task/resource aliases.
Parameters
- document OfficeIMO.Project.ProjectDocument