PublishedProject class

Represents a project that is published on Project Server.

Inheritance hierarchy

System.Object
  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)

Syntax

'Declaration
<ScriptTypeAttribute("PS.PublishedProject", ServerTypeId := "{94083bd1-9d58-40b3-becf-c4703547d63c}")> _
Public Class PublishedProject _
    Inherits Project
'Usage
Dim instance As PublishedProject
[ScriptTypeAttribute("PS.PublishedProject", ServerTypeId = "{94083bd1-9d58-40b3-becf-c4703547d63c}")]
public class PublishedProject : Project

Remarks

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());

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

Reference

PublishedProject members

Microsoft.ProjectServer.Client namespace