Compartilhar via


PS.ProjectContext.current property (ps.js)

Obtém o contexto de cliente atual do tempo de execução do cliente Project Server 2013 .

var value = PS.ProjectContext.get_current()

Valor retornado

PS.ProjectContext
o contexto de cliente atual para a instância de Project Web App .

Example

O exemplo de código a seguir mostra como obter o contexto atual. Consulte o guia de Introdução com o modelo de objeto de JavaScript para que o exemplo de código completo.

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);
}