PublishedProject class
Represents a project that is published on Project Server.
Microsoft.SharePoint.Client.ClientObject
Microsoft.ProjectServer.Client.Project
Microsoft.ProjectServer.Client.PublishedProject
Namespace: Microsoft.ProjectServer.Client
Assembly: Microsoft.ProjectServer.Client (in Microsoft.ProjectServer.Client.dll)
To check out a 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("http://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); projContext.Load(newPublishedProj); projContext.ExecuteQuery(); DateTime pubDate = newPublishedProj.LastPublishedDate; Console.Write("\n\tLastPublishedDate before publishing: {0}", pubDate.ToString());