Wei Painter
Wei Painter

Reputation: 1

How to extract the value of RBS in Enterprise Resource in Project Server 2019?

I try to retrieve the value of RBS in Enterprise Resource in Project Server by using C#/ CSOM. Unfortunately, I just get the Resource Name, as for the value of RBS, I always cannot handle it. I shared the code for you to look at and hope the seasoned people can help me to address it or sharing some idea in this. I appreciate your help. Thanks.

Explanation:

  1. The Enterprise Resources will be extracted by ID.
  2. "projectContext" will load specificRes with all Custom Fields.
  3. I'm going to retrieve the value of a specific field (RBS)
  4. Finally, When I specify to retrieve the value of "RBS", no matter how I change the Resource Id, the value of RBS is the same

`var specificRes = projectContext.EnterpriseResources.GetById(new Guid("46914ae8-3c55-488d-a045-4d1a5aaf1e74").ToString());

        projectContext.Load(specificRes, 
            r => r.Name,
            r => r.CustomFields,
            r => r.CustomFields.IncludeWithDefaultProperties(
                            lu => lu.LookupTable,
                            lu => lu.LookupEntries));
        projectContext.ExecuteQuery();

        var cusField = specificRes.CustomFields.FirstOrDefault(cf => cf.InternalName == "Custom_000039b78bbe4ceb82c4fa8c0c400284");
        projectContext.Load(cusField);
        projectContext.ExecuteQuery();

        Console.WriteLine(cusField.LookupEntries.First().FullValue);`

I hope I could get a simple answer/ solution from this. Because I am a new player on Project Server.

Upvotes: 0

Views: 11

Answers (0)

Related Questions