You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何实现SharePoint列表按钮更新当前日期时间字段?

SharePoint列表按钮更新DateTime列问题解决
  • 问题根源:你用的"Now ()"是错误写法,SharePoint列格式化的setValue动作里,获取当前日期时间必须用内置的@now变量,不需要加引号、空格和括号。
  • 列类型无需调整:RunbookLastUpdated保持DateTime类型即可,不用修改。

修正后的列格式化代码:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "button",
  "txtContent": "Update Runbook",
  "customRowAction": {
    "action": "setValue",
    "actionInput": {
      "UpdatedBy": "@me",
      "RunbookLastUpdated": "@now"
    }
  }
}

补充说明:@now返回的是UTC时间,SharePoint会自动根据站点时区转换显示,无需额外处理。

内容的提问来源于stack exchange,提问作者Justin E

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 14:30:43