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:
The attached example also writes the various datasets to XML files, for debugging purposes. Keep in mind that the app user must have the ManageUsersAndGroups global permission, and the other permissions specified in the SDK topics for the methods used, in order to read data of other resources.
The attached ReadRBS.zip file contains the complete Visual Studio solution for the example described in this post. To use the sample, change the server name and Project Server name for the endpoint addresses in the app.config file. The sample uses the WCF interface for Project Server 2010; however, it can be adapted to use the ASMX interface for Project Server 2007.
For example, the following command gets the same RBS value shown by the Reporting database query:
C:\Test>ReadRbs -name "Linda Jones"
XML output from ReadResources: C:\Project\Samples\Output\RBS_ReadResources_UserInfo.xml
Using ReadResources method: 412.309 milliseconds
XML output from ReadResource: C:\Project\Samples\Output\RBS_ReadResource_FullUserInfo.xml
XML output from ReadLookupTables: C:\Project\Samples\Output\RBS_LookupTable.xml
User name: Linda Jones GUID: 0D455775-01CB-42E1-A481-A6F0F1F8208A RBS value: User Assistance.DevDocs.SDK Writers
Press any key to exit...
I am unable to unzip readrbs.zip. I've tried windows explorer and 7zip. Both report issues. Is this file correct?
The file was corrupted somehow. It has been replaced, and now works -- please try it again.
Thanks,
--Jim