[英]Create Work Object in Project Server Timesheet Line using REST API Error
所以我嘗試構建使用項目服務器 2013 REST API 的移動應用程序。 此處的目標是編輯特定時間表中的每一行,包括刪除和添加對象。 問題是,如果我想在任何一天使用此 POST 方法未在 PWA 中設置的“工作”對象,
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() 方法的要求進行了。 有沒有人有想法?
先感謝您
我找到了解決方案。 REST API 工作正常,但為了使用 POST 方法調用它,您必須傳遞所需的所有參數,否則它會給您這些錯誤。
'parameters': {
'ActualWork':'value',
'Comment':'value',
'End':'value',
'NonBillableOvertimeWork':'value',
'NonBillableWork':'value',
'OvertimeWork':'value',
'PlannedWork':'value',
'Start':'value'
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.