【问题标题】:Set Finish Project Column via API通过 API 设置完成项目列
【发布时间】:2021-06-16 13:50:54
【问题描述】:

当我尝试通过 SmartSheet API 在工作表中的一行上设置完成列时,我收到以下消息:

{
    "errorCode": 1080,
    "message": "End Dates on dependency-enabled sheets cannot be created/updated. Please update either the Duration or Start Date column.",
    "refId": "19ufon4xzsn7y",
    "detail": {
        "index": 0,
        "rowId": 4987804240111492
    }
}

如果我想清除特定行的项目日期,我可以将 Duration 和 Start 列设置为 null,但 Finish 日期仍然存在。见https://smartsheet-platform.github.io/api-docs/#update-rows

清除项目日期(包括完成)的程序化方式是什么?

【问题讨论】:

    标签: smartsheet-api


    【解决方案1】:

    我能够通过 API 在启用依赖项的工作表上以编程方式更新完成日期。

    为此,我必须在their specified format 中传递日期字符串,并在Start DateDuration cell objects 上填充strict 属性= true

    使用 C#,您可以使用此方法获得正确格式化的日期字符串 代码:startDate.ToString("O")

    【讨论】:

      【解决方案2】:

      我认为,只要为工作表启用依赖项,就不可能以编程方式更新Finish 日期。请注意,这是指定为工作表启用依赖项的工作表设置(在 Smartsheet UI 中):

      如果我手动取消选中此框并通过 Smartsheet UI 保存更改,那么我随后能够通过 API 成功更新 Finish 日期。不幸的是,似乎不可能通过 API禁用工作表的依赖项(即,取消选中此框的编程等效项)。我尝试这样做,但收到一个错误,指出您无法通过 API 设置 dependenciesEnabled 属性。

      请求:

      PUT /sheet/{sheetId)
      {
         "dependenciesEnabled": false
      }
      

      回复:

      {
          "errorCode": 1032,
          "message": "The attribute(s) sheet.dependenciesEnabled are not allowed for this operation.",
          "refId": "10pl3li0rs9b"
      }
      

      【讨论】:

      • 谢谢,金。此外,当在工作表中禁用依赖项时,持续时间列变为普通文本/数字字段,不再支持持续时间值,例如“10d”、“2w”等。
      • @Rick - 感谢您指出这一点。您描述的行为与我的预期一致。 “启用依赖项”是使工作表成为“项目”工作表的原因(即,告诉 Smartsheet 将数据视为项目计划,包括依赖项、持续时间、开始日期、结束日期等)。如果禁用依赖项,Smartsheet 将不再将数据视为项目计划,因此项目表中这些特殊列的任何特殊列类型和自动计算将不再存在。
      猜你喜欢
      • 2017-03-23
      • 2016-11-13
      • 2016-06-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多