Testing Columns in a Project DataSet

Larry Duff of the Project team wrote a very nice article describing how to test column values when making calls to the Project Server PSI:  https://blogs.msdn.com/lduff/archive/2006/12/06/testing-columns-in-a-dataset.aspx

DavidK remarked in a comment that the PSI offers methods to handle the case where a column in the result set does not have a value.  If you use these, you don't need to do a try-catch:

private string GetWSSSite(Guid projectGuid)
{
ProjectWS.ProjectDataSet pds =
ProjWebSvc.ReadProject(projectGuid,ProjectWS.DataStoreEnum.PublishedStore);

return (pds == null)
|| (pds.Project.Rows.Count == 0)
|| pds.Project[0].IsWPROJ_STS_SUBWEB_NAMENull() ?
String.Empty : pds.Project[0].WPROJ_STS_SUBWEB_NAME;
}

I don't believe that the subweb name is a mandatory field, so it's appropriate to return String.Empty as a result rather than throwing an exception.  (But if the ReadProject call returns no results you may want to think about throwing an exception if you expect that projectGuid refers to a valid project.)  Another note: the IsXXXNull() method exists for all columns in all DataRow classes in the PSI. If you write code against the PSI you should get in the habit of taking advantage of these methods.