Read Project Online Project data using JSOM


In this article, I’m going to discuss about reading Project Online Project Data using JSOM (JavaScript Object Model) with a simple code.
First create a .js file with the below code then upload it to the document library on the PWA tenant. Add it to a content editor web part of the Project Center page.

Add the below links to make use of the existing SharePoint and Project online APIs.

script src=""></script>
script type="text/javascript" src ="/_layouts/15/sp.runtime.js"></script>
script type="text/javascript" src ="/_layouts/15/sp.js"></script>
script type="text/javascript" src="/_layouts/15/ps.js"></script>

<script type="text/javascript">
var projectContext;
var custom_Fields;</span>
var Allprojects;</span>

jQuery(document).ready(function () {
  SP.SOD.executeOrDelayUntilScriptLoaded(ReadProjectsWithCustomFields, "PS.js");

//Read project data from the Project context object and loop through each project
function ReadProjectsWithCustomFields() {
  var projectContext = PS.ProjectContext.get_current();
  var Allprojects = projectContext.get_projects();
  projectContext.load(Allprojects, 'Include(Id, Name,Owner)');
  projectContext.executeQueryAsync(dowithProjects, errorHandler);
  function dowithProjects() {
    var Projenumerator = Allprojects.getEnumerator();
    while (Projenumerator.moveNext()) {
      var projectInfo = Projenumerator.get_current();
function errorHandler(sender, args) {
  if (args instanceof SP.ClientRequestFailedEventArgs) {
    alert( args.get_message());

The above code will return you the Project Name, Project ID, and Project Owner Name.
Thanks for reading.