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 | |
---|---|---|
Assignment | Contains the common properties for draft assignments and published assignments. | |
AssignmentCreationInformation | Contains the properties that can be set when creating an assignment. | |
BaseCalendarException | Represents the collection of base calendar exceptions. | |
Calendar | Represents a Project Server calendar. | |
CalendarCollection | Represents a collection of calendars objects. | |
CalendarCreationInformation | Represents information that is used to create a new calendar. | |
CalendarException | Represents a difference (an exception) from the base calendar. | |
CalendarExceptionCollection | Represents a collection of calendar exceptions. | |
CalendarExceptionCreationInformation | Provides information for the creation of a calendar exception. | |
CustomField | Contains the properties and methods that are used to create an enterprise custom field. | |
CustomFieldCollection | Represents a collection of CustomField objects. | |
CustomFieldCreationInformation | Provides information that is used in the creation of a custom field. | |
DraftAssignment | Enables the creation of a draft assignment for a project. | |
DraftAssignmentCollection | Represents a collection of DraftAssignment objects. | |
DraftProject | Represents the draft version of a project, which is a project that is checked out. | |
DraftProjectResource | Represents an enterprise resource in a checked-out project. | |
DraftProjectResourceCollection | Represents a collection of DraftProjectResource objects. | |
DraftTask | Represents a task in a checked-out project. | |
DraftTaskCollection | Represents a collection of DraftTask objects. | |
DraftTaskLink | Creates an object to access the task links in a draft project. | |
DraftTaskLinkCollection | Represents a collection of DraftTaskLink objects. | |
EnterpriseProjectType | Creates an object that represents an enterprise project type. | |
EnterpriseProjectTypeCollection | Represents a collection of EnterpriseProjectType (EPT) objects. | |
EnterpriseProjectTypeCreationInformation | Provides information for the creation of an enterprise project type (EPT). | |
EnterpriseResource | Represents a resource that is managed by Project Server in a project. | |
EnterpriseResourceCollection | Represents a collection of EnterpriseResource objects. | |
EnterpriseResourceCreationInformation | Provides information for the creation of an enterprise resource. | |
EntityType | Represents a type of Project Server entity. | |
EntityTypes | Represents the types of Project Server entities that are exposed through CSOM. | |
Event | Represents and identifies activity that occurs in Project Server when there are changes in business object data. | |
EventCollection | Represents a collection of Event objects. | |
EventHandler | Represents the identification and location of a Project Server event handler. | |
EventHandlerCollection | Represents a collection of EventHandler objects. | |
EventHandlerCreationInformation | Provides information for the creation of an event handler. | |
LookupCost | Contains a data value for a lookup table of type Cost. | |
LookupDate | Contains a data value for a lookup table of type Date. | |
LookupDuration | Contains a data value for a lookup table of type Duration. | |
LookupEntry | Represents a lookup table entry. | |
LookupEntryCollection | Represents a collection of LookupEntry objects for a lookup table. | |
LookupEntryCreationInformation | Provides information for the creation of a lookup table entry. | |
LookupEntryValue | Represents the value of a lookup table entry. | |
LookupMask | Represents a mask definition for the levels of a hierarchical lookup table. | |
LookupNumber | Contains a data value for a lookup table of type Number. | |
LookupTable | Represents a lookup table. | |
LookupTableCollection | Represents a collection of LookupTable objects. | |
LookupTableCreationInformation | Provides methods and property settings for the creation of a lookup table. | |
LookupTables | Represents lookup table definitions. | |
LookupText | Defines an entry in a lookup table of type Text. | |
Phase | Represents a collection of stages that are grouped to identify a common set of activities in the project life cycle. | |
PhaseCollection | Represents a collection of workflow Phase objects. | |
PhaseCreationInformation | Provides methods and property settings that are used in the creation of a workflow phase. | |
PlanAssignment | Provides information about an assignment in a project plan. | |
PlanAssignmentCollection | Represents a collection of plan assignment objects. | |
PlanAssignmentCreationInformation | Provides information for the creation of a PlanAssignment object. | |
PlanAssignmentInterval | Represents the collection of time intervals for a project plan assignment. | |
PlanAssignmentIntervalCollection | Represents a collection of PlanAssignmentInterval objects. | |
PlanAssignmentIntervalCreationInformation | Provides information that is used for the creation of PlanAssignmentInterval objects. | |
Project | Contains the common properties for draft projects and published projects. | |
ProjectCollection | Represents a collection of PublishedProject objects. | |
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. | |
ProjectCreationInformation | Contains the properties that can be set when creating a project. | |
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. | |
ProjectDetailPageCollection | Represents a collection of project detail pages (PDPs). | |
ProjectDetailPageCreationInformation | Provides information that is used to create a project detail page (PDP) for an enterprise project type. | |
ProjectResource | Provides information about a project resource. | |
ProjectResourceCreationInformation | Provides property settings and methods for the creation of a project resource entity. | |
ProjectServer | Used internally by client-side code. To initialize the client context for development with the Project Server CSOM, use ProjectContext. | |
ProjectServerData | Represents a connection to a server. | |
PublishedAssignment | Represents the assignment that is in a published project. | |
PublishedAssignmentCollection | Represents a collection of published assignments. | |
PublishedProject | Represents a project that is published on Project Server. | |
PublishedProjectResource | Represents an enterprise resource that is published on Project Server. | |
PublishedProjectResourceCollection | Represents a collection of resources in a published project. | |
PublishedTask | Represents a task in a published project. | |
PublishedTaskCollection | Represents a collection of tasks in a published project. | |
PublishedTaskLink | Represents a dependency relationship between the start and finish dates of two tasks. | |
PublishedTaskLinkCollection | Represents a collection of task links in a published project. | |
QueueJob | Queues a project for publishing. | |
QueueJobCollection | Represents a collection of QueueJob objects. | |
ResourceCalendarException | Represents a resource calendar exception. | |
ResourcePlan | Represents a high-level look at what resources might be needed for a project. | |
ScriptTypeFactory | This class and its members are reserved for internal use and are not intended to be used in your code. | |
ServiceStatus | Provides information about the status of the Project Server service. | |
Stage | Represents a stage in a project workflow. | |
StageCollection | Represents a collection of workflow Stage objects. | |
StageCreationInformation | Provides methods and properties that are used to create a project workflow stage. | |
StageCustomField | Represents a custom field for a project stage. | |
StageCustomFieldCollection | Represents a collection of StageCustomField objects, which are custom fields in a workflow stage. | |
StageCustomFieldCreationInformation | Provides property settings and methods that are used to add a custom field to project stage information. | |
StageDetailPage | Represents a project detail page (PDP) for a workflow stage. | |
StageDetailPageCollection | Represents a collection of project detail pages (PDPs) that are visible in a workflow stage. | |
StageDetailPageCreationInformation | Provides property settings and methods that are used to create a project detail page (PDP) for a workflow stage. | |
StatusAssignment | Provides an object that is an assignment in a status update. | |
StatusAssignmentCollection | Represents a collection of StatusAssignment objects, which are assignments in a status update. | |
StatusAssignmentCreationInformation | Provides property settings and methods for the creation of a status assignment object. | |
StatusTask | Provides an object that keeps track of the progress of a task. | |
StatusTaskCreationInformation | Provides property settings and methods for the creation of a status task object. | |
Task | Contains methods and properties that can be used to access the details of the task. | |
TaskCreationInformation | Provides property settings and methods that are used to create a task. | |
TaskLink | Represents the dependency relationship between the start and finish dates of two tasks. | |
TaskLinkCreationInformation | Provides property settings and methods that are used to create a task link. | |
TimePhase | Represents assignment progress information that is distributed over time. | |
TimeSheet | Contains the methods and properties for managing a timesheet. | |
TimeSheetLine | Represents a line in a timesheet. | |
TimeSheetLineCollection | Represents a collection of timesheet lines. | |
TimeSheetLineCreationInformation | Provides property settings and methods that are used to create a timesheet line. | |
TimeSheetPeriod | Represents a defined period of time on a timesheet. | |
TimeSheetPeriodCollection | Represents a collection of TimeSheetPeriod objects. | |
TimeSheetWork | Represents the different types of work on a timesheet. | |
TimeSheetWorkCollection | Provides a collection of actual work entries for a timesheet. | |
TimeSheetWorkCreationInformation | Provides property settings and methods that are used to create a timesheet work object. | |
WorkflowActivities | Contains methods that encapsulate Project Server workflow activities and methods, for use with version 4 of Windows Workflow Foundation (WF4). | |
WorkflowDesigner | Creates an object that can be used to design a workflow. | |
WorkflowDesignerField | Represents a field that is created in a workflow designer. | |
WorkflowDesignerFieldCollection | Represents a filtered collection of enterprise project custom fields that can be used in a workflow designer. |
Enumerations
Enumeration | Description | |
---|---|---|
AccrueAt | The cost accrual mode specifies how and when resource costs are to be charged to the cost of a task. | |
BookingType | Specifies how resources are booked for assignments. | |
CalendarRecurrenceDays | Represents the days of the week for recurring calendar exceptions. | |
CalendarRecurrenceType | Specifies the recurrence types for a calendar exception. | |
CalendarRecurrenceWeek | Specifies one week of a month that is used to setup a schedule. | |
CommittedDecisionResult | Specifies whether an item is included in an optimizer function or a planner function for project portfolio analysis. | |
ConstraintType | Specifies the constraint type for a task. | |
CurrencySymbolPosition | Specifies the placement of the currency symbol. | |
CustomFieldRollupType | Specifies the summary roll-up type for a custom field. | |
CustomFieldType | Specifies the type for an enterprise custom field. | |
DependencyType | Specifies the type of dependency to establish between two tasks. | |
EnterpriseResourceType | Represents the different types of enterprise resources. | |
FixedCostAccrual | Specifies how and when fixed costs are to be charged to the cost of a task. | |
JobState | The Project Server queue job state specifies the status of a queue job. | |
LookupTableConstants | Specifies the maximum values and the minimum values for lookup table entities. | |
LookupTableMaskSequence | Specifies the mask sequence, which is the type of data for a lookup table. | |
LookupTableSortOrder | Specifies the sort order for a lookup table. | |
OvertimeRateFormat | Specifies the time unit of the resource overtime rate; that is, the rate per time unit, such as dollars per hour. | |
ProjectDetailPageType | Specifies the type of project detail page (PDP). | |
ProjectType | Specifies the type of project. | |
QueueMsgType | Specifies the queue message type, for sending a job to the Project Server Queue System. | |
ReadyToLeaveProjectStageValue | Specifies the project stage requirements in a Project Server workflow, to help determine whether the workflow is ready to leave the stage. | |
ResourceType | Specifies the types of resources. | |
StandardRateFormat | Specifies the time unit of the resource rate; that is, the rate per time unit, such as dollars per hour. | |
StrategicImpactBehavior | Specifies how strategic impact values behave in a Project Server workflow stage. | |
TaskType | Specifies whether the task type in a project is fixed units, fixed work, or fixed duration. | |
TimeScale | Specifies the scale of the timephased data. | |
TimeSheetEntryMode | Contains the timesheet entry modes. | |
TimeSheetLineClass | Represents classifications that define the different uses of a timesheet line. | |
TimeSheetLineStatus | Represents status settings that can be applied to a timesheet line. | |
TimeSheetStatus | Represents status settings that can be applied to a timesheet. | |
TimeSheetValidationType | Specifies the set of validation types for timesheet lines. | |
TrackingMode | Specifies the modes for tracking task progress. | |
UpdateProjectStageStatusFieldValue | Specifies the status of the project stage in a Project Server workflow. | |
UtilizationType | Specifies the type of resource use for the current resource plan. | |
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.
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
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).
Set references to the assemblies that are specified in step 1.
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.
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);
}
}
}