SharePoint Events

  5/13/2013 - Conference: SharePoint Summit 2013
  5/21/2013 - Webcast: SharePoint 2013 and ECM: Content Migration and Storage
  5/22/2013 - Webcast: Managing CAD in SharePoint
  5/23/2013 - Webcast: SharePoint Document Automation and E-Forms for Financial Services
  5/24/2013 - Webcast: What's New in Search for SharePoint 2013

 SharePoint Videos

  Why SharePoint 2013
  SharePoint 2013 Launch
  SharePoint 2013 Migration and Governance
  SharePoint 2013 and Enterprise Content Management
  Top Benefits of SharePoint 2013
  What's New in Business Intelligence in Office and SharePoint 2013
  SharePoint and Office 2013 Integration
  SharePoint 2013 Infrastructure Preview
  SharePoint, Lync, and, Exchange in the Cloud with Office 365
  Advanced Reporting in SharePoint with Microsoft Power View

 Archives

Opening SharePoint Links in a new windowUse SHIFT+ENTER to open the menu (new window).
Mail Enabled Lists vs. The Missing Windows 2008 POP3/IMAP Server Use SHIFT+ENTER to open the menu (new window).
7 Tools for SharePoint DevelopersUse SHIFT+ENTER to open the menu (new window).
Public Facing Masterpage TechniquesUse SHIFT+ENTER to open the menu (new window).
How to Quickly Deploy and Activate a Timer Service to Your Site CollectionUse SHIFT+ENTER to open the menu (new window).
Custom SharePoint Master Page Feature with WSP BuilderUse SHIFT+ENTER to open the menu (new window).
Date Math with InfoPathUse SHIFT+ENTER to open the menu (new window).
Enterprise Search Tricks and Tips Part 1Use SHIFT+ENTER to open the menu (new window).
Populating Word Documents With SharePoint Data. Try The DIP!Use SHIFT+ENTER to open the menu (new window).
Programmatic Deep Dive into Blank SharePoint Lookup ColumnsUse SHIFT+ENTER to open the menu (new window).
1 - 10 Next
Programmatically Access Project Information in Project Server 2010

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.

SharePoint_Blog_Programmatically_Access_Project_Information_in_Project_Server_2010

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

        

Comments

There are no comments yet for this post.
Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Your Name *


e-mail address *


Website (optional)


Comment *


Attachments

 Subscribe

  GigWerks RSS  Gig Werks Mailing List 

 Contact Us

 Connect

 Resources

  On Demand SharePoint Webcast Recordings
  Upcoming Webinars
  SharePoint Resources
  Business Intelligence Resources
  Gig Werks Website



©2009 Gig Werks. All rights reserved. Privacy Policy