SharePoint Column Format

https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting

1. { "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "div", "debugMode": true, "txtContent": "@currentField", "style": { "color": "=if([$DueDate] <= @now, '#ff0000', '')" } }
小于当前(Now)日期的标红色:

2. 当前时间距离到期时间30天以内需要标记列为红色:
    (24*30*60*60*1000 = 2592000000).
    
    
    {
       "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
       "elmType": "div",
       "txtContent": "@currentField",
       "style": {
          "color": {
             "operator": "?",
             "operands": [
                {
                   "operator": ">=",
                   "operands": [
                      "[$StartDate]",
                      {
                         "operator": "+",
                         "operands": [
                            "@now",
                            2592000000
                         ]
                      }
                   ]
                },
                "#ff0000",
                ""
             ]
          }
       }
    }


3. 不满足日期的当前行标记红色:
    {
      "schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
       "additionalRowClass": "=if([$DueDate] <= @now, 'sp-field-severity--severeWarning', '')"
}
原文地址:https://www.cnblogs.com/Nigel/p/10382600.html