Share via


DraftProject.IncludeCustomFields property

Gets a DraftProject object that includes custom fields.

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

Syntax

'Declaration
<RemoteAttribute> _
Public ReadOnly Property IncludeCustomFields As DraftProject
    Get
'Usage
Dim instance As DraftProject
Dim value As DraftProject

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

Property value

Type: Microsoft.ProjectServer.Client.DraftProject
A draft project.

Remarks

For projects with many custom fields, performance can be slow when retrieving and saving the project. When you use the PublishedProject.CheckOut method to check out a project, by default, the DraftProject object does not include custom fields. By using the IncludeCustomFields property, the project that is checked out includes custom field information.

Examples

The following CheckoutProject method checks out a project that includes custom fields.

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;
}

See also

Reference

DraftProject class

DraftProject members

Microsoft.ProjectServer.Client namespace

PublishedProject.CheckOut

PublishedProject.IncludeCustomFields