PublishedProject class
表示專案伺服器發佈的專案。
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
'宣告
<ScriptTypeAttribute("PS.PublishedProject", ServerTypeId := "{94083bd1-9d58-40b3-becf-c4703547d63c}")> _
Public Class PublishedProject _
Inherits Project
'用途
Dim instance As PublishedProject
[ScriptTypeAttribute("PS.PublishedProject", ServerTypeId = "{94083bd1-9d58-40b3-becf-c4703547d63c}")]
public class PublishedProject : Project
備註
若要簽出專案,以供編輯,請使用PublishedProjectCheckOut()方法。
專案伺服器建立一個虛擬PublishedProject物件的每一個尚未發佈的草稿專案。虛擬已發佈的專案會確保可擷取草稿專案,透過ProjectCollection物件,是否要或不剪除。擷取的專案會從專案資料庫中的草稿資料表取得屬性。
例如,如果在 PSI,以建立草稿專案,然後閱讀以 CSOM 的所有專案的ProjectCollection物件包含未發行的草稿專案。您可以決定專案是否已發行的PublishedProject.LastPublishedDate屬性,繼承自Project.LastPublishedDate的值。未發行的專案中, LastPublishedDate屬性值是DateTime.Min (1/1/0001)。下列的 CSOM 程式碼片段建立草稿專案,但不會保存或將其發佈。
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);
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.