Client-side object model (CSOM) for Project 2013

The Project Server 2013 client-side object model (CSOM) implements common server functionality. The Project Server CSOM includes a Microsoft .NET CSOM, a Microsoft Silverlight CSOM, a Windows Phone 8 CSOM, and a JavaScript object model (JSOM). In addition, the CSOM includes an OData service that enables a REST interface. The REST interface is intended primarily for development of apps on non-Windows platforms such as iOS and Android.

Note

Solutions for Project Online must use the CSOM. However, on-premises apps can use either the CSOM or the Project Server Interface (PSI). If the CSOM includes the functionality you plan to use, we recommend that you use the CSOM for new apps.

In CSOM extensions, the ProjectContext object provides the entry point to server content and functionality. The .NET CSOM, the Silverlight CSOM, and the Windows Phone CSOM use the Microsoft.ProjectServer.Client.ProjectContext object, and the JSOM uses the PS.ProjectContext object. ProjectContext properties provide direct access to core Project Server objects in the current Project Web App site collection. For information about the location of the CSOM assemblies and the JavaScript file, see Microsoft.ProjectServer.Client.

Apps and the security model Apps must use the CSOM for CRUD (create, read, update, delete) operations with Project Server 2013 and Project Online. Project apps do not use the app-only authentication model in SharePoint 2013. A Project Server app requires a specific permission request scope that specifies on whose behalf commands are being run.

REST queries You can create REST queries of the CSOM OData service without consuming the metadata. Some third-party tools enable using the .NET assemblies for the CSOM to develop apps for other devices. For example, search the Internet for "cross-platform .NET development tools for iOS or Android."

Note

Although the $metadata option for the ProjectData reporting service is valid ( https://ServerName/pwaName/_api/ProjectData/$metadata), the $metadata option for the ProjectServer service of the CSOM is removed in the released version of Project Server 2013. To find the CSOM objects and members that are available as REST endpoints, see the JavaScript library and REST reference for Project Server 2013.

To see the entities available in the CSOM through the REST interface, you can use the https://ServerName/pwaName/_api/ProjectServer query. For REST queries, the ProjectServer entity closely mirrors properties of the ProjectContext object in the Microsoft.ProjectServer.Client.dll managed assembly and the PS.ProjectContext object in the JSOM. For example, you can use your browser to get information from the CSOM about projects in Project Web App, the assignments in a specified project, and the task name of a specified assignment for a specified resource, by using the following queries (each query uses the same https://ServerName/pwaName/_api URL prefix). The GUIDs are sample values for Project.Id, EnterpriseResource.Id, and Assignment.Id.

/ProjectServer/Projects
/ProjectServer/Projects('263fc8d7-427c-e111-92fc-00155d3ba208')/Assignments
/ProjectServer/EnterpriseResources('28eeb2b5-fe74-4efc-aa35-6a64514d1526')/Assignments('a2eafeb5-437c-e111-92fc-00155d3ba208')/Task?$select=Name

Unlike the OData interface for the ProjectData service, which is read-only for reporting, you can do CRUD operations using REST queries with the ProjectServer service. REST queries for the Project Server CSOM are designed primarily for platforms other than the Windows desktop, such as Windows RT, iOS, and Android. For Windows desktop and server platforms, such as Windows 7, Windows 8, and Windows Server 2008 R2, you can use the CSOM managed assemblies. For web apps, you can use PS.js for JavaScript. For information about doing CRUD operations using REST queries, see the Use OData query operations in SharePoint REST requests topic in the SharePoint 2013 SDK. For information about using the ProjectData service, see Querying OData feeds for Project reporting data.

Table 1 lists the ProjectContext properties that represent Project Server objects. You can use these objects to retrieve other Project Server 2013 entities, such as assignments and tasks.

Table 1. ProjectContext properties that provide access to Project Server objects in the CSOM and JSOM

CSOM (.NET, Silverlight, and Windows Phone) JSOM
CustomFields
customFields
EnterpriseProjectTypes
enterpriseProjectTypes
EnterpriseResources
enterpriseResources
EntityTypes
entityTypes
EventHandlers
eventHandlers
Events
events
LookupTables
lookupTables
Phases
phases
Projects
projects
Stages
stages
WorkflowActivities
workflowActivities
WorkflowDesigner
workflowDesigner

In this section

Getting started with the Project Server CSOM and .NET provides overview information about the Project Server CSOM and .NET, instructions about how to create a simple .NET CSOM extension in Visual Studio 2012, and supporting code examples.

Getting started with the Project Server 2013 JavaScript object model provides overview information about the Project Server JSOM, instructions about how to create a simple JSOM extension in Visual Studio 2012, and supporting code examples.

Also, check out these articles that show how to use the CSOM:

Note

You can also use Visual Studio 2010 for .NET Framework 4 development with the CSOM.

Reference

Microsoft.ProjectServer.Client

See also

Project Server 2013 architecture Choose the right API set in SharePoint 2013