PS.ProjectContext.current property (ps.js)

Gets the current client context of the Project Server 2013 client-side runtime.

Applies to: Project Professional 2013 | Project Server 2013

var value = PS.ProjectContext.get_current()

Return value

The current client context for the Project Web App instance.


The following code example shows how to get the current context. 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);