首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用REST API错误在Project Server时间表行中创建工作对象

使用REST API错误在Project Server时间表行中创建工作对象
EN

Stack Overflow用户
提问于 2020-02-13 13:25:41
回答 1查看 293关注 0票数 0

因此,我尝试构建使用project server 2013 REST API的移动应用程序。这里的目标是编辑特定时间表中的每一行,包括删除和添加对象。问题是,如果我想在任何一天使用这个POST方法创建一个没有在PWA中设置的'work‘对象,

https://myweb.com/PWA/_api/ProjectServer/TimeSheetPeriods('mytimesheetId')/TimeSheet/Lines('choosenlineId')/Work/Add

有了这个身体,

代码语言:javascript
复制
{
    "parameters": {
        "End":"2020-02-10T23:59:59",
        "Start":"2020-02-11T00:00:00",
        "ActualWork": "8h",
                "Comment": null,
                "NonBillableWork": "0h",
                "OvertimeWork": "0h",
                "PlannedWork": "0h"
        }
}

我将收到此错误消息,

代码语言:javascript
复制
{
    "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()方法所请求的。有谁有主意吗?

提前谢谢你

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-02-27 14:40:19

我找到了解决方案。REST API工作得很好,但是为了使用POST方法调用它,你必须传递所有需要的参数,否则它会给你这些错误。

代码语言:javascript
复制
'parameters': {
        'ActualWork':'value', 
        'Comment':'value', 
        'End':'value', 
        'NonBillableOvertimeWork':'value', 
        'NonBillableWork':'value', 
        'OvertimeWork':'value', 
        'PlannedWork':'value', 
        'Start':'value'     
    }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60200979

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档