Microsoft.ProjectServer.Client namespace

Classes in this namespace define the client-side object model (CSOM) for Microsoft Project Server 2013.

The CSOM is accessible from both Project Online and from an on-premises Project Server installation, through the Microsoft.Project.Server.Client namespace. The Project Server CSOM is designed to be a relatively easy to use API that directly consumes or provides data by name, rather than by passing datasets or by using changeXml parameters. The CSOM implements the main functionality of the Project Server Interface (PSI) for the primary entities such as Project, Task, EnterpriseResource, and Assignment. It includes additional entities such as CustomField, LookupTable, WorkflowActivities, EventHandler, and QueueJob, which support other common Project Server functionality.

The CSOM is an API that is built on top of the PSI; it does not replace the PSI or implement all of the PSI functionality. The CSOM can be accessed in the following ways:

  • As an assembly to use with Microsoft .NET Framework 4.0: %ProgramFiles%\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.ProjectServer.Client.dll

    The Microsoft.ProjectServer.Client namespace in the Class library and Web Service Reference section of the Project 2013 SDK documents the managed code for general development of .NET-based CSOM applications.

  • As an assembly to use for development with Silverlight: %ProgramFiles%\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\LAYOUTS\ClientBin\Microsoft.ProjectServer.Client.Silverlight.dll

  • As an assembly to use for development of apps for Microsoft Windows Phone 8: %ProgramFiles%\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\LAYOUTS\ClientBin\Microsoft.ProjectServer.Client.Phone.dll

  • As a file to use for development of web applications with JavaScript: %ProgramFiles%\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\LAYOUTS\PS.js or PS.debug.js

    For the JavaScript reference to the CSOM, see JavaScript library and REST reference for Project Server 2013.

  • A web app can also access the CSOM through REST. For example, you can use the following query to get data for all of the projects in a Project Web App instance:

    https://ServerName/ProjectServerName/_api/ProjectServer/Projects
    

    For more information, see Client-side object model (CSOM) for Project Server and Programming using the SharePoint 2013 REST service.

The Project 2013 SDK download also includes the assemblies and JavaScript files for the Project Server CSOM. If you update Project Server with a service pack, you should copy the updated assemblies and JavaScript files to your development computer.

The primary Project Server entities are generally represented in the CSOM by six classes, for example:

  • The base class, such as Assignment, contains the common properties for the draft entity and the published entity.

  • The creation information class, such as AssignmentCreationInformation, contains the properties that are used to create an entity.

  • The draft class, such as DraftAssignment, includes the read/write properties that represent the entity for editing.

  • The published class, such as PublishedAssignment, includes the read-only properties that represent the published entity.

  • The draft collection class, such as DraftAssignmentCollection, includes the Add method to add a draft entity to the collection, the GetById method to get a specific entity for editing, and the Remove method to delete an entity.

  • The published collection class, such as PublishedAssignmentCollection, generally includes the GetById method to get a specific entity for reading or for checking out to edit.

The ProjectContext class and the ProjectServer class each maintain the client-side context for application development, and contain entity collections that are globally accessible in a Project Web App instance, such as Projects, EnterpriseResources, EnterpriseProjectTypes, CustomFields, LookupTables, and Events. Because the ProjectServer class is provided for internal use by client-side objects, applications should use the ProjectContext class, which is initialized with the Project Web App path.

For a simple example of programming with the CSOM, see the Example section later on this page. For more information about development with the CSOM, see Client-side object model (CSOM) for Project 2013. The managed code reference in the Project 2013 SDK provides basic descriptions and remarks for the properties of entities, which are also described in the classes for namespaces in the PSI. For detailed information about the properties of entities, see Available fields reference.

The CSOM for Project Server 2013 is built on the CSOM for SharePoint Foundation 2013. For more information, see Choose the right API set in SharePoint 2013.

Classes

  Class Description
Public class Assignment Contains the common properties for draft assignments and published assignments.
Public class AssignmentCreationInformation Contains the properties that can be set when creating an assignment.
Public class BaseCalendarException Represents the collection of base calendar exceptions.
Public class Calendar Represents a Project Server calendar.
Public class CalendarCollection Represents a collection of calendars objects.
Public class CalendarCreationInformation Represents information that is used to create a new calendar.
Public class CalendarException Represents a difference (an exception) from the base calendar.
Public class CalendarExceptionCollection Represents a collection of calendar exceptions.
Public class CalendarExceptionCreationInformation Provides information for the creation of a calendar exception.
Public class CustomField Contains the properties and methods that are used to create an enterprise custom field.
Public class CustomFieldCollection Represents a collection of CustomField objects.
Public class CustomFieldCreationInformation Provides information that is used in the creation of a custom field.
Public class DraftAssignment Enables the creation of a draft assignment for a project.
Public class DraftAssignmentCollection Represents a collection of DraftAssignment objects.
Public class DraftProject Represents the draft version of a project, which is a project that is checked out.
Public class DraftProjectResource Represents an enterprise resource in a checked-out project.
Public class DraftProjectResourceCollection Represents a collection of DraftProjectResource objects.
Public class DraftTask Represents a task in a checked-out project.
Public class DraftTaskCollection Represents a collection of DraftTask objects.
Public class DraftTaskLink Creates an object to access the task links in a draft project.
Public class DraftTaskLinkCollection Represents a collection of DraftTaskLink objects.
Public class EnterpriseProjectType Creates an object that represents an enterprise project type.
Public class EnterpriseProjectTypeCollection Represents a collection of EnterpriseProjectType (EPT) objects.
Public class EnterpriseProjectTypeCreationInformation Provides information for the creation of an enterprise project type (EPT).
Public class EnterpriseResource Represents a resource that is managed by Project Server in a project.
Public class EnterpriseResourceCollection Represents a collection of EnterpriseResource objects.
Public class EnterpriseResourceCreationInformation Provides information for the creation of an enterprise resource.
Public class EntityType Represents a type of Project Server entity.
Public class EntityTypes Represents the types of Project Server entities that are exposed through CSOM.
Public class Event Represents and identifies activity that occurs in Project Server when there are changes in business object data.
Public class EventCollection Represents a collection of Event objects.
Public class EventHandler Represents the identification and location of a Project Server event handler.
Public class EventHandlerCollection Represents a collection of EventHandler objects.
Public class EventHandlerCreationInformation Provides information for the creation of an event handler.
Public class LookupCost Contains a data value for a lookup table of type Cost.
Public class LookupDate Contains a data value for a lookup table of type Date.
Public class LookupDuration Contains a data value for a lookup table of type Duration.
Public class LookupEntry Represents a lookup table entry.
Public class LookupEntryCollection Represents a collection of LookupEntry objects for a lookup table.
Public class LookupEntryCreationInformation Provides information for the creation of a lookup table entry.
Public class LookupEntryValue Represents the value of a lookup table entry.
Public class LookupMask Represents a mask definition for the levels of a hierarchical lookup table.
Public class LookupNumber Contains a data value for a lookup table of type Number.
Public class LookupTable Represents a lookup table.
Public class LookupTableCollection Represents a collection of LookupTable objects.
Public class LookupTableCreationInformation Provides methods and property settings for the creation of a lookup table.
Public class LookupTables Represents lookup table definitions.
Public class LookupText Defines an entry in a lookup table of type Text.
Public class Phase Represents a collection of stages that are grouped to identify a common set of activities in the project life cycle.
Public class PhaseCollection Represents a collection of workflow Phase objects.
Public class PhaseCreationInformation Provides methods and property settings that are used in the creation of a workflow phase.
Public class PlanAssignment Provides information about an assignment in a project plan.
Public class PlanAssignmentCollection Represents a collection of plan assignment objects.
Public class PlanAssignmentCreationInformation Provides information for the creation of a PlanAssignment object.
Public class PlanAssignmentInterval Represents the collection of time intervals for a project plan assignment.
Public class PlanAssignmentIntervalCollection Represents a collection of PlanAssignmentInterval objects.
Public class PlanAssignmentIntervalCreationInformation Provides information that is used for the creation of PlanAssignmentInterval objects.
Public class Project Contains the common properties for draft projects and published projects.
Public class ProjectCollection Represents a collection of PublishedProject objects.
Public class ProjectContext Maintains the client-side context for development with a Project Web App instance, and contains the enterprise-wide collections of Project Server objects that exist in Project Web App.
Public class ProjectCreationInformation Contains the properties that can be set when creating a project.
Public class ProjectDetailPage Represents a project detail page (PDP), which is a Web Part page for creating, viewing, or managing the properties of projects in Project Web App.
Public class ProjectDetailPageCollection Represents a collection of project detail pages (PDPs).
Public class ProjectDetailPageCreationInformation Provides information that is used to create a project detail page (PDP) for an enterprise project type.
Public class ProjectResource Provides information about a project resource.
Public class ProjectResourceCreationInformation Provides property settings and methods for the creation of a project resource entity.
Public class ProjectServer Used internally by client-side code. To initialize the client context for development with the Project Server CSOM, use ProjectContext.
Public class ProjectServerData Represents a connection to a server.
Public class PublishedAssignment Represents the assignment that is in a published project.
Public class PublishedAssignmentCollection Represents a collection of published assignments.
Public class PublishedProject Represents a project that is published on Project Server.
Public class PublishedProjectResource Represents an enterprise resource that is published on Project Server.
Public class PublishedProjectResourceCollection Represents a collection of resources in a published project.
Public class PublishedTask Represents a task in a published project.
Public class PublishedTaskCollection Represents a collection of tasks in a published project.
Public class PublishedTaskLink Represents a dependency relationship between the start and finish dates of two tasks.
Public class PublishedTaskLinkCollection Represents a collection of task links in a published project.
Public class QueueJob Queues a project for publishing.
Public class QueueJobCollection Represents a collection of QueueJob objects.
Public class ResourceCalendarException Represents a resource calendar exception.
Public class ResourcePlan Represents a high-level look at what resources might be needed for a project.
Public class ScriptTypeFactory This class and its members are reserved for internal use and are not intended to be used in your code.
Public class ServiceStatus Provides information about the status of the Project Server service.
Public class Stage Represents a stage in a project workflow.
Public class StageCollection Represents a collection of workflow Stage objects.
Public class StageCreationInformation Provides methods and properties that are used to create a project workflow stage.
Public class StageCustomField Represents a custom field for a project stage.
Public class StageCustomFieldCollection Represents a collection of StageCustomField objects, which are custom fields in a workflow stage.
Public class StageCustomFieldCreationInformation Provides property settings and methods that are used to add a custom field to project stage information.
Public class StageDetailPage Represents a project detail page (PDP) for a workflow stage.
Public class StageDetailPageCollection Represents a collection of project detail pages (PDPs) that are visible in a workflow stage.
Public class StageDetailPageCreationInformation Provides property settings and methods that are used to create a project detail page (PDP) for a workflow stage.
Public class StatusAssignment Provides an object that is an assignment in a status update.
Public class StatusAssignmentCollection Represents a collection of StatusAssignment objects, which are assignments in a status update.
Public class StatusAssignmentCreationInformation Provides property settings and methods for the creation of a status assignment object.
Public class StatusTask Provides an object that keeps track of the progress of a task.
Public class StatusTaskCreationInformation Provides property settings and methods for the creation of a status task object.
Public class Task Contains methods and properties that can be used to access the details of the task.
Public class TaskCreationInformation Provides property settings and methods that are used to create a task.
Public class TaskLink Represents the dependency relationship between the start and finish dates of two tasks.
Public class TaskLinkCreationInformation Provides property settings and methods that are used to create a task link.
Public class TimePhase Represents assignment progress information that is distributed over time.
Public class TimeSheet Contains the methods and properties for managing a timesheet.
Public class TimeSheetLine Represents a line in a timesheet.
Public class TimeSheetLineCollection Represents a collection of timesheet lines.
Public class TimeSheetLineCreationInformation Provides property settings and methods that are used to create a timesheet line.
Public class TimeSheetPeriod Represents a defined period of time on a timesheet.
Public class TimeSheetPeriodCollection Represents a collection of TimeSheetPeriod objects.
Public class TimeSheetWork Represents the different types of work on a timesheet.
Public class TimeSheetWorkCollection Provides a collection of actual work entries for a timesheet.
Public class TimeSheetWorkCreationInformation Provides property settings and methods that are used to create a timesheet work object.
Public class WorkflowActivities Contains methods that encapsulate Project Server workflow activities and methods, for use with version 4 of Windows Workflow Foundation (WF4).
Public class WorkflowDesigner Creates an object that can be used to design a workflow.
Public class WorkflowDesignerField Represents a field that is created in a workflow designer.
Public class WorkflowDesignerFieldCollection Represents a filtered collection of enterprise project custom fields that can be used in a workflow designer.

Enumerations

  Enumeration Description
Public enumeration AccrueAt The cost accrual mode specifies how and when resource costs are to be charged to the cost of a task.
Public enumeration BookingType Specifies how resources are booked for assignments.
Public enumeration CalendarRecurrenceDays Represents the days of the week for recurring calendar exceptions.
Public enumeration CalendarRecurrenceType Specifies the recurrence types for a calendar exception.
Public enumeration CalendarRecurrenceWeek Specifies one week of a month that is used to setup a schedule.
Public enumeration CommittedDecisionResult Specifies whether an item is included in an optimizer function or a planner function for project portfolio analysis.
Public enumeration ConstraintType Specifies the constraint type for a task.
Public enumeration CurrencySymbolPosition Specifies the placement of the currency symbol.
Public enumeration CustomFieldRollupType Specifies the summary roll-up type for a custom field.
Public enumeration CustomFieldType Specifies the type for an enterprise custom field.
Public enumeration DependencyType Specifies the type of dependency to establish between two tasks.
Public enumeration EnterpriseResourceType Represents the different types of enterprise resources.
Public enumeration FixedCostAccrual Specifies how and when fixed costs are to be charged to the cost of a task.
Public enumeration JobState The Project Server queue job state specifies the status of a queue job.
Public enumeration LookupTableConstants Specifies the maximum values and the minimum values for lookup table entities.
Public enumeration LookupTableMaskSequence Specifies the mask sequence, which is the type of data for a lookup table.
Public enumeration LookupTableSortOrder Specifies the sort order for a lookup table.
Public enumeration OvertimeRateFormat Specifies the time unit of the resource overtime rate; that is, the rate per time unit, such as dollars per hour.
Public enumeration ProjectDetailPageType Specifies the type of project detail page (PDP).
Public enumeration ProjectType Specifies the type of project.
Public enumeration QueueMsgType Specifies the queue message type, for sending a job to the Project Server Queue System.
Public enumeration ReadyToLeaveProjectStageValue Specifies the project stage requirements in a Project Server workflow, to help determine whether the workflow is ready to leave the stage.
Public enumeration ResourceType Specifies the types of resources.
Public enumeration StandardRateFormat Specifies the time unit of the resource rate; that is, the rate per time unit, such as dollars per hour.
Public enumeration StrategicImpactBehavior Specifies how strategic impact values behave in a Project Server workflow stage.
Public enumeration TaskType Specifies whether the task type in a project is fixed units, fixed work, or fixed duration.
Public enumeration TimeScale Specifies the scale of the timephased data.
Public enumeration TimeSheetEntryMode Contains the timesheet entry modes.
Public enumeration TimeSheetLineClass Represents classifications that define the different uses of a timesheet line.
Public enumeration TimeSheetLineStatus Represents status settings that can be applied to a timesheet line.
Public enumeration TimeSheetStatus Represents status settings that can be applied to a timesheet.
Public enumeration TimeSheetValidationType Specifies the set of validation types for timesheet lines.
Public enumeration TrackingMode Specifies the modes for tracking task progress.
Public enumeration UpdateProjectStageStatusFieldValue Specifies the status of the project stage in a Project Server workflow.
Public enumeration UtilizationType Specifies the type of resource use for the current resource plan.
Public enumeration WorkFormat Contains a value that represents a work format.

Examples

Following are the steps to create a simple console application named ReadProjectList that uses classes in the Microsoft.ProjectServer.Client namespace to read the collection of published projects.

  1. If you are developing on a remote computer, copy the following assemblies from the Project 2013 SDK download or from %ProgramFiles%\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI on the Project Server computer to a convenient folder on the development computer:

    • Microsoft.ProjectServer.Client.dll

    • Microsoft.SharePoint.Client.dll

    • Microsoft.SharePoint.Client.Runtime.dll

  2. In Visual Studio 2012, create a console application. For this example, name the application ReadProjectList. In the New Project dialog box, set the target framework to .NET Framework 4.5. You could also use Visual Studio 2010 with .NET Framework 4 (do not use .NET Framework 4 Client Profile).

  3. Set references to the assemblies that are specified in step 1.

  4. Replace the code in the Program.cs file with the following code.

    Note

    You should set the CSOM context by using the ProjectContext object, not by using the ProjectServer object.

  5. Press F5 to run the application.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.ProjectServer.Client;

namespace ReadProjectList
{
    class Program
    {
        private const string pwaPath = "https://ServerName/PwaName/";    // Change the path for Project Web App.
        
        // Set the context for the Project Server CSOM.
        private static ProjectContext projContext;

        static void Main(string[] args)
        {
            projContext = new ProjectContext(pwaPath); 

            // Get the list of published projects in Project Web App.
            projContext.Load(projContext.Projects);
            projContext.ExecuteQuery();

            Console.WriteLine("\nProject ID : Project name : Created date");

            foreach (PublishedProject pubProj in projContext.Projects)
            {
                Console.WriteLine("\n\t{0}\n\t{1} : {2}", pubProj.Id.ToString(), pubProj.Name, 
                    pubProj.CreatedDate.ToString());
            }

            Console.Write("\nPress any key to exit: ");
            Console.ReadKey(false);
        }
    }
}

See also

Reference

Other resources

Client-side object model (CSOM) for Project Server

JavaScript API reference