Reading Enterprise RBS values: the Easy Way and the Not-So-Easy Way

There are a couple of ways to programmatically get the Resource Breakdown Structure (RBS) value for a Project Server user. The simplest way is to query the Reporting database, for example: SELECT [ResourceUID] ,[ResourceName] ,[ResourceBookingType] ,[ResourceIsActive] ,[RBS] FROM [ProjectServer_Reporting] .[dbo].[MSP_EpmResource_UserView] AS res WHERE res .ResourceName = N'Linda Jones' The result on my machine is: ResourceUID ResourceName ResourceBookingType ResourceIsActive RBS 0D455775-01CB-42E1-A481-A6F0F1F8208A Linda Jones 0 1 User Assistance.DevDocs.SDK Writers To get the RBS by using the PSI is a bit more work. Because the RBS is an enterprise resource custom field that uses the RBS lookup table, you can use the following steps: Call the ReadResources method and filter the primary Resources table for the user name and GUID. Alternately, you can use the ReadUserList method to get all of the active resource names and GUIDs, and iterate through the ResourceDataSet for the specific resource. The attached example uses the –userList command line argument to have the application use the ReadUserList method, and displays the elapsed time for the method used. Call ReadResource with the resource GUID to get the full ResourceDataSet . Iterate through the ResourceDataSet. ResourceCustomFields table to get the CODE_VALUE for the RBS custom field (if it exists). Use a filter with the ReadLookupTables method to get a LookupTableDataSet that contains only the LookupTableTrees table for the RBS lookup table. Iterate through the LookupTableTrees table to get the LT_VALUE_FULL string that corresponds to the CODE_VALUE in the RBS custom field.


Leave a comment!

You must be logged in to post a comment.