ProjectServer.Projects property

Office 2013 and later

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

Namespace:  Microsoft.ProjectServer.Client
Assembly:  Microsoft.ProjectServer.Client (in Microsoft.ProjectServer.Client.dll)

[RemoteAttribute]
public ProjectCollection Projects { get; }

Property value

Type: Microsoft.ProjectServer.Client.ProjectCollection
A collection of Project objects.

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

NoteNote

We recommend that you use the ProjectContext object instead of ProjectServer.

The following example uses the ProjectServer object to list the published projects in Project Web App. For the same application that uses the ProjectContext object, see ProjectContext.Projects. For information about creating a simple CSOM application in Microsoft Visual Studio, see Microsoft.ProjectServer.Client.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.Client;
using Microsoft.ProjectServer.Client;

namespace ReadProjectList
{
    class Program
    {
        private const string pwaPath = "http://ServerName/PwaName/";    // Change the path for Project Web App.
        private static ProjectServer projSvr;
        private static ClientRuntimeContext context;

        static void Main(string[] args)
        {
            context = new ClientContext(pwaPath);
            projSvr = new ProjectServer(context);

            // Get the list of published projects in Project Web App.
            context.Load(projSvr.Projects);
            context.ExecuteQuery();

            Console.WriteLine("\nProject ID : Project name : Created date");

            foreach (PublishedProject pubProj in projSvr.Projects)
            {
                Console.WriteLine("\n\t{0}\n\t{1} : {2}", pubProj.Id.ToString(), pubProj.Name, 
                    pubProj.CreatedDate.ToString());
            }

            Console.Write("\nPress any key to exit: ");
            Console.ReadKey(false);
        }
    }
}
Show: