none
Project Online CSOM create new CostRate RRS feed

  • Question

  • I am able to add a resource using the snippets below.

                    Guid guid = Guid.NewGuid();
                    EnterpriseResourceCreationInformation erci = new EnterpriseResourceCreationInformation();
                    erci.Id = guid;
                    erci.Name = "John Doe";
                    erci.IsInactive = false;
                    erci.ResourceType = EnterpriseResourceType.Work;
                    EnterpriseResource er = projContext.EnterpriseResources.Add(erci);

    I tried to add CostRates (StandardRate, OvertimeRate, and CostPerUse) using EnterpriseResource (er) above, but it doesn't work. Can someone help?

     CostRateCreationInformation crci = new CostRateCreationInformation();
                    crci.StandardRate = 110.0;
                    crci.OvertimeRate = 0.0;
                    crci.CostPerUse = 0.0;
                    crci.EffectiveDate = DateTime.Today;
                    er.CostRateTables.GetByName(CostRateTableName.A).CostRates.Add(crci);

                    projContext.EnterpriseResources.Update();
                    projContext.ExecuteQuery();

    Thursday, March 21, 2019 5:44 PM