拜托,您能帮我从名称中有空格的自定义字段创建/更新项目吗?
我们有一个带有自定义字段的项目Contact phone
。该字段可以在浏览器中正确使用。https://github.com/Workfront/workfront-api-examples-csharp没有帮助。我能够在问题的详细信息中添加数据。我想在特定的自定义字段中添加它(创建/更新)。
var client = new AtTaskRestClient(_url); // from the example
...
var description = $"Contact phone: {item.ContactPhone}";
client.Create(ObjCode.ISSUE, new { name = item.Name,
description = description,
projectID = _projectID });
client.Create
有一个对象作为最终参数。我们使用不能包含"DE:Contact phone" = item.ContactPhone
在构造函数中的匿名类型。我们如何写这个字段?
DE:Contact phone
如果我们从浏览器插入值,读取工作正常:
JToken issues = client.Search(ObjCode.ISSUE, new { projectID = _projectID });
foreach (var issue in issues["data"].Children()) {
var name = issue.Value<string>("name"); // correct
var id = issue.Value<string>("ID"); // correct
var fields = client.Get(ObjCode.ISSUE, id, new[] { "description", "DE:Contact phone"}); // correct