由于Project Server 2016中删除了一些SOAP操作, 我们尝试用REST API调用/草稿/赋值('assignmentid')替换过时的SOAP Statusing / UpdateStatus API调用,以便分配资源并设置'actualWork'属性。 MSDN文档说我们可以向该URL发送MERGE或PUT请求,但它没有提到请求有效负载应该是什么样子。
您能告诉我这次通话的JSON有效负载应该是什么吗?
MERGE _api / ProjectServer / Projects('projectid')/ Draft / Assignments('assignmentid')
API文档:https://msdn.microsoft.com/en-us/library/office/jj668054.aspx
答案 0 :(得分:1)
replace things in < > with appropriate values for your data
1) CheckOut the project
POST <pwaUrl>/_api/projectserver/projects('<projectId>')/checkout
2) Add enterprise resource to project team
POST <pwaUrl>/_api/projectserver/projects('<projectId>')/draft/projectresources/addenterpriseresourcebyid('<enterpriseResourceId>')
3) Create the assignment to an existing task
POST <pwaUrl>/_api/projectserver/projects('<projectId>')/draft/assignments/add()
{ "parameters":{
"ResourceId":"<enterpriseResourceId>",
"TaskId":"<taskId>"
}
}
4) edit 1 or more assignment properties
PATCH <pwaUrl>/_api/projectserver/projects('<projectId>')/draft/assignments('<draftAssigmentId>')
{ "ActualWorkTimeSpan":"PT24H" }
5a) Publish & check-in:
POST <pwaUrl>/_api/projectserver/projects('<projectId>')/draft/publish(true)
5b) Or just Check-in (if you don’t want to publish):
POST <pwaUrl>/_api/projectserver/projects('<projectId>')/draft/checkin(false)