Share via

ProjectCollection class

Represents a collection of PublishedProject objects.

Inheritance hierarchy


Namespace:  Microsoft.ProjectServer.Client
Assembly:  Microsoft.ProjectServer.Client (in Microsoft.ProjectServer.Client.dll)


<ScriptTypeAttribute("PS.ProjectCollection", ServerTypeId := "{8d842010-5471-4748-ab8a-ed6df0494f3d}")> _
Public Class ProjectCollection _
    Inherits ClientObjectCollection(Of PublishedProject)
Dim instance As ProjectCollection
[ScriptTypeAttribute("PS.ProjectCollection", ServerTypeId = "{8d842010-5471-4748-ab8a-ed6df0494f3d}")]
public class ProjectCollection : ClientObjectCollection<PublishedProject>


To check out a published project for editing, use the PublishedProjectCheckOut() method.

Project Server creates a virtual PublishedProject object for each draft project that has not yet been published. A virtual published project ensures that a draft project can be retrieved through the ProjectCollection object, whether it has been published or not. A retrieved project gets properties from the draft tables in the Project database.

For example, if you create a draft project with the PSI, and then read all projects with the CSOM, the ProjectCollection object contains the unpublished draft project. You can determine whether a project has been published by the value of the PublishedProject.LastPublishedDate property, which is inherited from Project.LastPublishedDate. For an unpublished project, the LastPublishedDate property value is DateTime.Min (1/1/0001). The following CSOM code fragment creates a draft project but does not persist or publish it.

ProjectContext projContext = new ProjectContext("https://ServerName/pwa");
ProjectCreationInformation newProj = new ProjectCreationInformation();

newProj.Id = Guid.NewGuid();
newProj.Name = "Test project not published";
newProj.Start = DateTime.Today.Date;

PublishedProject newPublishedProj = projContext.Projects.Add(newProj);


DateTime pubDate = newPublishedProj.LastPublishedDate;
Console.Write("\n\tLastPublishedDate before publishing: {0}", pubDate.ToString());

Thread safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See also


ProjectCollection members

Microsoft.ProjectServer.Client namespace