Share via


DraftProject.IncludeCustomFields 屬性

取得DraftProject物件,其中包含自訂欄位。

命名空間:  Microsoft.ProjectServer.Client
組件:  Microsoft.ProjectServer.Client (在 Microsoft.ProjectServer.Client.dll 中)

語法

'宣告
<RemoteAttribute> _
Public ReadOnly Property IncludeCustomFields As DraftProject
    Get
'用途
Dim instance As DraftProject
Dim value As DraftProject

value = instance.IncludeCustomFields
[RemoteAttribute]
public DraftProject IncludeCustomFields { get; }

屬性值

類型:Microsoft.ProjectServer.Client.DraftProject
草稿專案。

備註

專案具有許多自訂欄位,效能可能很緩慢擷取及儲存專案時。當您使用PublishedProject.CheckOut方法來取出專案中,根據預設, DraftProject物件不包含在自訂欄位。使用IncludeCustomFields屬性,來取出的專案會包含自訂欄位的資訊。

範例

下列CheckoutProject方法取出的專案,包括自訂欄位。

private static DraftProject CheckoutProject(ProjectContext projContext, string projName)
{
    DraftProject projCheckedOut = null;

    var projCollection = projContext.LoadQuery(
        projContext.Projects
            .Where(p => p.Name == projName));

    projContext.ExecuteQuery();

    if (projCollection.Count() > 0)
    {
        PublishedProject proj2Edit = projCollection.First().IncludeCustomFields;

        projCheckedOut = proj2Edit.CheckOut().IncludeCustomFields;
    }
    return projCheckedOut;
}

請參閱

參照

DraftProject 類別

DraftProject 成員

Microsoft.ProjectServer.Client 命名空間

PublishedProject.CheckOut

PublishedProject.IncludeCustomFields