Project.ReadProjectList method

Gets the project name, GUID, and type of each project that is available on the Project Web App instance.

Namespace:  WebSvcProject
Assembly:  ProjectServerServices (in ProjectServerServices.dll)

Syntax

'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Project/ReadProjectList", RequestNamespace := "https://schemas.microsoft.com/office/project/server/webservices/Project/",  _
    ResponseNamespace := "https://schemas.microsoft.com/office/project/server/webservices/Project/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function ReadProjectList As ProjectDataSet
'Usage
Dim instance As Project
Dim returnValue As ProjectDataSet

returnValue = instance.ReadProjectList()
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Project/ReadProjectList", RequestNamespace = "https://schemas.microsoft.com/office/project/server/webservices/Project/", 
    ResponseNamespace = "https://schemas.microsoft.com/office/project/server/webservices/Project/", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public ProjectDataSet ReadProjectList()

Return value

Type: WebSvcProject.ProjectDataSet
The ProjectDataSet schema contains only the Project table, with the following fields: PROJ_UID, PROJ_NAME, and PROJ_TYPE.

Remarks

ReadProjectStatus can be used to get a list of projects that are visible to any Project Server user. Because it gets a list of all projects, ReadProjectList is intended for use with administrative utilities and requires a high level of permissions.

An application must be logged on to a Project Server instance with valid user credentials before it can execute ReadProjectList.

Use the Project property of the ProjectDataSet to access the list of projects.

Project Server Permissions

Permission

Description

ManageQueue

Allows a user to manage the Queuing Service. Global permission.

ManageSecurity

Allows a user to manage security settings. Global Permission.

Examples

The following example creates a sample project, and then lists the projects that are found.

For critical information about running this code sample, see Prerequisites for ASMX-based code samples in Project 2013.

using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Web.Services.Protocols;
using System.Data;
using System.Threading;
using PSLibrary = Microsoft.Office.Project.Server.Library;

namespace Microsoft.SDK.Project.Samples.ReadProjectList
{
   class Program
   {
      [STAThread]
      static void Main()
      {
         try
         {
            const string PROJECT_SERVER_URI = "https://ServerName/ProjectServerName/";
            const string PROJECT_SERVICE_PATH = "_vti_bin/psi/project.asmx";
          
            // Set up the web service objects.
            SvcProject.Project projectSvc = new SvcProject.Project();

            projectSvc.Url = PROJECT_SERVER_URI + PROJECT_SERVICE_PATH;
            projectSvc.Credentials = CredentialCache.DefaultCredentials;

            // Read and display the project list.
            Console.WriteLine("Reading the project list");

            SvcProject.ProjectDataSet projectDs = projectSvc.ReadProjectList();
            foreach (SvcProject.ProjectDataSet.ProjectRow projectRow in projectDs.Project)
            {
               Console.WriteLine(projectRow.PROJ_NAME + " (" + projectRow.PROJ_UID + ")");
            }

         }
         catch (SoapException ex)
         {
            PSLibrary.PSClientError error = new PSLibrary.PSClientError(ex);
            PSLibrary.PSErrorInfo[] errors = error.GetAllErrors();
            string errMess = "==============================\r\nError: \r\n";
            for (int i = 0; i < errors.Length; i++)
            {
               errMess += "\n" + ex.Message.ToString() + "\r\n";
               errMess += "".PadRight(30, '=') + "\r\nPSCLientError Output:\r\n \r\n";
               errMess += errors[i].ErrId.ToString() + "\n";

               for (int j = 0; j < errors[i].ErrorAttributes.Length; j++)
               {
                  errMess += "\r\n\t" + errors[i].ErrorAttributeNames()[j] + ": " + errors[i].ErrorAttributes[j];
               }
               errMess += "\r\n".PadRight(30, '=');
            }
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine(errMess);
         }
         catch (WebException ex)
         {
            string errMess = ex.Message.ToString() +
               "\n\nLog on, or check the Project Server Queuing Service";
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("Error: " + errMess);
         }
         catch (Exception ex)
         {
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("Error: " + ex.Message);
         }
         finally
         {
            Console.ResetColor();
            Console.WriteLine("\r\n\r\nPress any key...");
            Console.ReadKey();
         }
      }
   }
}

See also

Reference

Project class

Project members

WebSvcProject namespace