所以我尝试构建使用项目服务器 2013 REST API 的移动应用程序。此处的目标是编辑特定时间表中的每一行,包括删除和添加对象。问题是,如果我想在 PWA 中使用此 POST 方法未设置的任何一天创建一个“工作”对象,
https://myweb.com/PWA/_api/ProjectServer/TimeSheetPeriods ('mytimesheetId')/TimeSheet/Lines('choosenlineId')/Work/Add
有了这个身体,
{
"parameters": {
"End":"2020-02-10T23:59:59",
"Start":"2020-02-11T00:00:00",
"ActualWork": "8h",
"Comment": null,
"NonBillableWork": "0h",
"OvertimeWork": "0h",
"PlannedWork": "0h"
}
}
我会收到此错误消息,
{
"error": {
"code": "42, Microsoft.ProjectServer.PJClientCallableException",
"message": {
"lang": "en-US",
"value": "PJClientCallableException: GeneralUnhandledException\r\nGeneralUnhandledException\r\nException = System.InvalidCastException: Cannot cast DBNull.Value to type 'System.Decimal'. Please use a nullable type.\r\n at System.Data.DataRowExtensions.UnboxT`1.ValueField(Object value)\r\n at Microsoft.Office.Project.Server.BusinessLayer.Timesheet.<ApplyChanges>b__c0(ActualsRow actualsRow)\r\n at Microsoft.Office.Project.Server.Library.PSUtility.Apply[T](IEnumerable`1 enumerable, Action`1 fn)\r\n at Microsoft.Office.Project.Server.BusinessLayer.Timesheet.ApplyChanges(TimesheetDataSet changes)\r\n at Microsoft.Office.Project.Server.BusinessLayer.TimeSheet.UpdateTimesheet(Guid tsUID, TimesheetDataSet timesheetDS)\r\n at Microsoft.Office.Project.Server.BusinessLayer.TimeSheet.QueueUpdateTimesheet(Guid jobUID, Guid tsUID, TimesheetDataSet dsDelta)\r\n at Microsoft.Office.Project.Server.Wcf.Implementation.TimeSheetImpl.<>c__DisplayClass31.<QueueUpdateTimesheet>b__30()\r\n at Microsoft.Office.Project.Server.Wcf.Implementation.WcfMethodInvocation.InvokeBusinessObjectMethod(String businessObjectName, String methodName, IEnumerable`1 actions)"
}
}
}
我认为这与 Project Server 2013 本身有关,因为我在正文中输入的参数已经按照 Add() 方法的要求。有人有想法吗?
先感谢您