Forum Discussion
How to extract the value of RBS in Enterprise Resource in Project Server 2019?
Yes, you can retrieve the RBS (Resource Breakdown Structure) information specific to a user by filtering based on the user’s resource ID or their specific criteria in the query.
Here's how you can get the RBS value for a specific user:
// Assuming you have the context and have authenticated
var projectContext = new ProjectContext("https://your-project-server-url/");
// Replace with the user's resource ID
Guid resourceId = new Guid("your-specific-resource-id");
// Retrieve the specific resource by ID
EnterpriseResource specificResource = projectContext.EnterpriseResources.GetById(resourceId);
// Load the resource with custom fields (including RBS)
projectContext.Load(specificResource,
r => r.CustomFields.Include(cf => cf.InternalName, cf => cf.LookupEntries, cf => cf.Value));
projectContext.ExecuteQuery();
// Now, retrieve the RBS field
var rbsField = specificResource.CustomFields.FirstOrDefault(cf => cf.InternalName == "Custom_RBS_Field_Internal_Name");
// If the RBS field exists, retrieve its full hierarchical path
if (rbsField != null && rbsField.LookupEntries != null)
{
string rbsValue = string.Join(" > ", rbsField.LookupEntries.Select(le => le.FullValue));
Console.WriteLine("RBS for the specified user: " + rbsValue);
}
else
{
Console.WriteLine("RBS information not found for the specified user.");
}
======================
Replace "your-specific-resource-id" with the actual resource ID for the user you're interested in.
Replace "Custom_RBS_Field_Internal_Name" with the actual internal name for the RBS custom field in your Project Server instance.
Check if the resource has an RBS assigned. If rbsField.LookupEntries is null or empty, the user might not have an RBS assigned.
Hi Mks_1973,
Thanks. I will give it a try at this first.