By: Yi Fan Tang
Although Project Server 2010 sits in a SharePoint 2010 site collection, it has its own database to store project data. Only Page Detail Pages and project sites are stored in the SharePoint content database. Project Server 2010 API has some out of the box web services that help you access project information programmatically. Today I am going to show you how to get some basic information and status of all the projects in the project server, such as, project ID, project name, project site, current stage, etc.
Basically, we need two web services to do this, the “LoginWindows.asmx” and “Project.asmx”. The addresses are:
http://ProjectServerURL/_vti_bin/psi/LoginWindows.asmx http://ProjectServerURL/_vti_bin/psi/Project.asmx
The “LoginWidows” web service gives you a “CookieContainer” to maintain a state in the “Project” web service. The “Project” web service is used for accessing the projects’ information.

In the “Project” web service, there is method called “ReadProjectList()” which returns a list of projects in the project server. Now the tricky thing is this method only returns very little information of the projects, for example, the project IDs and project names. If you want to get more information, you have to use the “ReadProject” method. However, “ReadProject” method requires the project ID. Thus, you need to pass the project IDs you get from “ReadProjectList()” to the “ReadProject” method to access more details of the projects. Bellow is the sample code:
//The Url of the project server
string projectServerURL = "http://ProjectServerURL";
//Access the out of box Project web servcie
ProjectService.Project project = new ProjectService.Project();
project.Url = projectServerURL + "/_vti_bin/psi/Project.asmx";
project.Credentials = CredentialCache.DefaultCredentials;
//Access the out of box LoginWindows web servcie
LoginWindowsService.LoginWindows loginWindows = new LoginWindowsService.LoginWindows();
loginWindows.Url = projectServerURL + "/_vti_bin/psi/LoginWindows.asmx";
loginWindows.Credentials = CredentialCache.DefaultCredentials;
//Populate the CookieContainer of the Project web service
loginWindows.CookieContainer = new CookieContainer();
project.CookieContainer = loginWindows.CookieContainer;
//Get a list of projects in the project server.
ProjectService.ProjectDataSet pjDataSet = project.ReadProjectList();
//Get the detail information of each project
foreach (ProjectService.ProjectDataSet.ProjectRow projectRow in pjDataSet.Project)
{
//The data set returned by ReadProjectList() method only contain some basic information of the projects
Guid projectID = projectRow.PROJ_UID;
string projectName = projectRow.PROJ_NAME;
//Get the project information from Working Store
ProjectService.ProjectDataSet workingProjectDataSet = project.ReadProject(projectID, ProjectService.DataStoreEnum.WorkingStore);
ProjectService.ProjectDataSet.ProjectRow workingProjectRow = workingProjectDataSet.Project[0];
//Get the project information from Published Store
ProjectService.ProjectDataSet publishedProjectDataSet = project.ReadProject(projectID, ProjectService.DataStoreEnum.PublishedStore);
ProjectService.ProjectDataSet.ProjectRow publishedProjectRow = publishedProjectDataSet.Project[0];
//Project Stage information is stored in the Working Store
Guid projectStageID = workingProjectRow.STAGE_UID;
string projectStageName = workingProjectRow.STAGE_NAME;
//Project work space information is stored in the Published Store
string projectWorkSpaceName = publishedProjectRow.WPROJ_STS_SUBWEB_NAME;
}
By: Yi Fan Tang