PS.ProjectContext.projects property (ps.js)

Gets the collection of published projects in the Project Web App instance.

Applies to: Project Professional 2013 | Project Server 2013

var value = PS.ProjectContext.get_projects()

Return value

PS.ProjectCollection
A collection of PublishedProject objects.

Remarks

A project entity contains additional entity types, such as tasks, resources, and assignments.

Example

The following code example shows how to get the published projects in the current Project Web App instance. See Getting started with the JavaScript object model for the complete code example.

function GetProjects() {

    // Initialize the current client context.
    var projContext = PS.ProjectContext.get_current();

    // Get the projects collection.
    projects = projContext.get_projects();

    // Register the request that you want to run on the server.
    // This call includes an optional "Include" parameter to request only the
    // Name, CreatedDate, and Id properties of the projects in the collection.
    projContext.load(projects, 'Include(Name, CreatedDate, Id)');

    // Run the request on the server.
    projContext.executeQueryAsync(onQuerySucceeded, onQueryFailed);
}