How to update resource cost rate in Microsoft Project 2019?

32 Views Asked by At

Our company has recently implemented Microsoft Project 2019. Now I am struggling with updating resource (employees) cost rate via program code. We need to update resources cost in Microsoft Project 2019 based on our ERP data values. Can you please refer me either to documentation regarding this or code examples? It can be C# language to work with. Thanks in advance.

I tried searching internet and asking ChatGPT.

1

There are 1 best solutions below

0
Kenny Arnold On

Here's an examaple that should help you out:

using MSP = Microsoft.Office.Interop.MSProject; // using statement at the top of class file.

public void LoadCostRates(MSP.Resource res)
    {
        MSP.CostRateTable costRateTable = res.CostRateTables[1];

        MSP.PayRate payRateInfo;

        payRateInfo = costRateTable.PayRates.Add(DateTime.Parse("01/01/2024"), "$100.00", "$150.00");
    }

If you need to edit the effective date of an existing payrate, the only way to do it that I can tell is to delete the payrate and then re-add it.

Note that you must have a reference to the MS Project API in your C# project in order for this to work.