{"id":1689,"date":"2017-12-20T11:22:58","date_gmt":"2017-12-20T16:22:58","guid":{"rendered":"https:\/\/www.a2life.info\/w\/?p=1689"},"modified":"2017-12-20T14:21:07","modified_gmt":"2017-12-20T19:21:07","slug":"sharepoint-column-formatter-%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9","status":"publish","type":"post","link":"https:\/\/www.a2life.info\/w\/?p=1689","title":{"rendered":"SharePoint Column Formatter \u306e\u4f7f\u3044\u65b9"},"content":{"rendered":"<p>SharePoint Online\u306e\u30c6\u30ca\u30f3\u30c8\u3067\u4e00\u30f6\u6708\u304f\u3089\u3044\u524d\u304b\u3089Push\u3055\u308c\u306f\u3058\u3081\u305f\u6a5f\u80fd\u306a\u306e\u3060\u304c\u3001\u30ea\u30b9\u30c8\u306e\u30b3\u30e9\u30e0\u30bb\u30c3\u30c6\u30a3\u30f3\u30b0\u306b\u201dColumn Formatting&#8221;\u3068\u3044\u3046\u306e\u304c\u8ffd\u52a0\u3055\u308c\u3066\u3044\u308b\u3002\u3000Text Entry Field \u306b\u306a\u3063\u3066\u304a\u308a\u3001\u8aac\u660e\u306f\u201dJSON\u66f8\u5f0f\u3067\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3092\u8a18\u5165\u3057\u3066\u304f\u3060\u3055\u3044\u201d\u3068\u304b\u306a\u308a\u305d\u3063\u3051\u306a\u3044\u3002\u3000\u8a73\u7d30\u306fOffice Dev\u306e\u307b\u3046\u306b\u3042\u308b\u3002\u3000<a href=\"https:\/\/docs.microsoft.com\/en-us\/sharepoint\/dev\/declarative-customization\/column-formatting\">\u3053\u3053<\/a>\u3000\u3002<\/p>\n<p>\u3055\u3089\u306b\u66f8\u5f0f\u30b5\u30f3\u30d7\u30eb\u306eDepository\u304cGitHUB\u306b\u304a\u3044\u3066\u3042\u308b\u3002\u3000<a href=\"https:\/\/github.com\/SharePoint\/sp-dev-column-formatting\">\u3053\u3053<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\u3067\u3001\u4e0a\u306e\u8a18\u8ff0\u3092\u53c2\u8003\u306bListView\u306e\u30ab\u30b9\u30bf\u30e0\u5316\u3092\u81ea\u5206\u3067\u8a66\u3057\u3066\u307f\u305f\u306e\u304c\u3053\u308c\u3002<\/p>\n<p><a href=\"https:\/\/www.a2life.info\/w\/?attachment_id=1690\" rel=\"attachment wp-att-1690\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1690\" src=\"https:\/\/www.a2life.info\/w\/wp-content\/uploads\/2017\/12\/columnFormatExample.jpg\" alt=\"\" width=\"447\" height=\"335\" srcset=\"https:\/\/www.a2life.info\/w\/wp-content\/uploads\/2017\/12\/columnFormatExample.jpg 447w, https:\/\/www.a2life.info\/w\/wp-content\/uploads\/2017\/12\/columnFormatExample-300x225.jpg 300w, https:\/\/www.a2life.info\/w\/wp-content\/uploads\/2017\/12\/columnFormatExample-400x300.jpg 400w\" sizes=\"auto, (max-width: 447px) 100vw, 447px\" \/><\/a><\/p>\n<p>\u3053\u3053\u3067\u306fChecked\u306eColumn Formatting \u306b\u4ee5\u4e0b\u3092\u6307\u5b9a<\/p>\n<pre>{\r\n  \"debugMode\": true,\r\n  \"elmType\":\"div\",\r\n  \"children\":[\r\n    {\r\n      \"elmType\": \"img\",\r\n      \"attributes\": {\r\n        \"src\": {\r\n          \"operator\":\"?\",\r\n          \"operands\":[\r\n            \"@currentField\",\r\n            \"\/_layouts\/images\/CNSAPP16.GIF\",\r\n            \"\/_layouts\/images\/CbUnChecked.gif\"\r\n          ]\r\n        },\r\n        \"aria-hidden\":\"true\"\r\n      },\r\n      \"style\": {\r\n\r\n      }\r\n    }\r\n  ]\r\n\r\n}\r\n\r\n\r\n<\/pre>\n<p>\u3053\u308c\u3067Yes\/No\u306e\u6587\u5b57\u8868\u793a\u3092\u30a2\u30a4\u30b3\u30f3\u30a4\u30e1\u30fc\u30b8\u306b\u7f6e\u304d\u63db\u3048\u3066\u3044\u308b\u3002<\/p>\n<p>Delivery Status\u306e\u30b3\u30e9\u30e0\u66f8\u5f0f\u306f\u3061\u3087\u3063\u3068\u9577\u304f\u306a\u308b\u3002\uff08\u53c2\u7167\u3059\u308b\u5404Column\u306e\u5185\u90e8\u540d\u79f0\u3092Column settings\u3067\u305d\u308c\u305e\u308c\u78ba\u8a8d\u3057\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308b\u3053\u3068\u306b\u6ce8\u610f\u3000\u4e0b\u306e\u4f8b\u3067\u306f\u3000Checked\u306fChecked\u3060\u304cDue Date\u306fTaskDueDate\u306b\u306a\u3063\u3066\u3044\u308b\uff09<\/p>\n<pre>{\r\n  \"debugMode\": true,\r\n  \"elmType\": \"div\",\r\n  \"attributes\": {\r\n    \"class\": {\r\n      \"operator\": \"?\",\r\n      \"operands\": [\r\n        \"[$Checked]\",\r\n        \"sp-field-severity--good\",\r\n        {\r\n          \"operator\": \"?\",\r\n          \"operands\": [\r\n            {\r\n              \"operator\": \"&lt;=\",\r\n              \"operands\": [\r\n                \"[$TaskDueDate]\",\r\n                {\r\n                  \"operator\": \"-\",\r\n                  \"operands\": [\r\n                    \"@now\",\r\n                    86400000\r\n                  ]\r\n                }\r\n              ]\r\n            },\r\n            \"sp-field-severity--severeWarning\",\r\n            {\r\n              \"operator\": \"?\",\r\n              \"operands\": [\r\n                {\r\n                  \"operator\": \"&lt;=\",\r\n                  \"operands\": [\r\n                    \"[$TaskDueDate]\",\r\n                    \"@now\"\r\n                  ]\r\n                },\r\n                \"sp-field-severity--blocked\",\r\n                {\r\n                  \"operator\": \"?\",\r\n                  \"operands\": [\r\n                    {\r\n                      \"operator\": \"&lt;=\",\r\n                      \"operands\": [\r\n                        \"[$TaskDueDate]\",\r\n                        {\r\n                          \"operator\": \"+\",\r\n                          \"operands\": [\r\n                            \"@now\",\r\n                            604800000\r\n                          ]\r\n                        }\r\n                      ]\r\n                    },\r\n                    \"sp-field-severity--warning\",\r\n                    \"sp-field-severity--low\"\r\n                  ]\r\n                }\r\n              ]\r\n            }\r\n          ]\r\n        }\r\n      ]\r\n    }\r\n  },\r\n  \"children\": [\r\n    {\r\n      \"elmType\": \"span\",\r\n      \"style\": {\r\n        \"display\": \"inline-block\",\r\n        \"padding\": \"0 4px\"\r\n      },\r\n      \"attributes\": {\r\n        \"iconName\": {\r\n          \"operator\": \"?\",\r\n          \"operands\": [\r\n            \"[$Checked]\",\r\n            \"CheckMark\",\r\n            {\r\n              \"operator\": \"?\",\r\n              \"operands\": [\r\n                {\r\n                  \"operator\": \"&lt;=\",\r\n                  \"operands\": [\r\n                    \"[$TaskDueDate]\",\r\n                    {\r\n                      \"operator\": \"-\",\r\n                      \"operands\": [\r\n                        \"@now\",\r\n                        86400000\r\n                      ]\r\n                    }\r\n                  ]\r\n                },\r\n                \"ErrorBadge\",\r\n                {\r\n                  \"operator\": \"?\",\r\n                  \"operands\": [\r\n                    {\r\n                      \"operator\": \"&lt;=\",\r\n                      \"operands\": [\r\n                        \"[$TaskDueDate]\",\r\n                        \"@now\"\r\n                      ]\r\n                    },\r\n                    \"Warning\",\r\n                    {\r\n                      \"operator\": \"?\",\r\n                      \"operands\": [\r\n                        {\r\n                          \"operator\": \"&lt;=\",\r\n                          \"operands\": [\r\n                            \"[$TaskDueDate]\",\r\n                            {\r\n                              \"operator\": \"+\",\r\n                              \"operands\": [\r\n                                \"@now\",\r\n                                604800000\r\n                              ]\r\n                            }\r\n                          ]\r\n                        },\r\n                        \"Error\",\r\n                        \"Forward\"\r\n                      ]\r\n                    }\r\n                  ]\r\n                }\r\n              ]\r\n            }\r\n          ]\r\n        }\r\n      }\r\n    },\r\n    {\r\n      \"elmType\": \"span\",\r\n      \"txtContent\": {\r\n        \"operator\": \"?\",\r\n        \"operands\": [\r\n          \"[$Checked]\",\r\n          \"Delivered\",\r\n          {\r\n            \"operator\": \"?\",\r\n            \"operands\": [\r\n              {\r\n                \"operator\": \"&lt;=\",\r\n                \"operands\": [\r\n                  \"[$TaskDueDate]\",\r\n                  {\r\n                    \"operator\": \"-\",\r\n                    \"operands\": [\r\n                      \"@now\",\r\n                      86400000\r\n                    ]\r\n                  }\r\n                ]\r\n              },\r\n              \"Past Due\",\r\n              {\r\n                \"operator\": \"?\",\r\n                \"operands\": [\r\n                  {\r\n                    \"operator\": \"&lt;=\",\r\n                    \"operands\": [\r\n                      \"[$TaskDueDate]\",\r\n                      \"@now\"\r\n                    ]\r\n                  },\r\n                  \"Due Today\",\r\n                  {\r\n                    \"operator\": \"?\",\r\n                    \"operands\": [\r\n                      {\r\n                        \"operator\": \"&lt;=\",\r\n                        \"operands\": [\r\n                          \"[$TaskDueDate]\",\r\n                          {\r\n                            \"operator\": \"+\",\r\n                            \"operands\": [\r\n                              \"@now\",\r\n                              604800000\r\n                            ]\r\n                          }\r\n                        ]\r\n                      },\r\n                      \"Nearing Due Date\",\r\n                      \"Upcoming\"\r\n                    ]\r\n                  }\r\n                ]\r\n              }\r\n            ]\r\n          }\r\n        ]\r\n      },\r\n      \"style\": {\r\n        \"color\": \"black\"\r\n      }\r\n    }\r\n  ]\r\n}\r\n<\/pre>\n<p>\u305d\u308c\u305e\u308c\u306eAttribute \uff08Text, Class, iConName)\u306b\u5bfe\u3057\u3066\u51fa\u529b\u306f\u7570\u306a\u308b\u3082\u306e\u306e\u6761\u4ef6\u81ea\u4f53\u306f\u540c\u3058\u5f0f\u3092\u3092\u7e70\u308a\u8fd4\u3057\u3066\u3044\u308c\u3066\u3084\u3089\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u306e\u3067\u8a18\u8ff0\u304c\u3084\u305f\u3089\u306b\u9577\u304f\u306a\u308b\u3002\u3000\u307e\u305f\u7c21\u5358\u306a\u6761\u4ef6\u5f0f\u3092\u5165\u308c\u5b50\u72b6\u306b\u7e70\u308a\u8fd4\u3057\u4f7f\u3046\u306e\u3067\u3001\u3069\u3093\u3069\u3093\u62ec\u5f27\u304c\u3075\u3048\u3066\u3044\u304f\u3002<\/p>\n<p>\u6761\u4ef6\u5f0f\u306e\u30ed\u30b8\u30c3\u30af\u3060\u304c\u3001 due date \u5f53\u65e5\u306b\u306f<\/p>\n<p>@now &#8211; 1 day &lt; Due Date &lt; @now<\/p>\n<p>\u306b\u306a\u3063\u3066\u3044\u308b\u3053\u3068\u3092\u5229\u7528\u3057\u3066\u3000\u4ee5\u4e0b\u306eIf\u69cb\u6587\u3092Jason\u306b\u3066\u8a18\u8ff0\u3057\u3066\u3044\u308b\u3002<\/p>\n<p>If checked == True then &#8220;Delivered\u3000\u7d0d\u54c1\u6e08\u307f&#8221;<br \/>\nelse if Due Date &lt; = @now &#8211; 1 day then &#8220;Over Due \u7d0d\u671f\u9045\u308c&#8221;<br \/>\nelse if Due Date &lt; = @ now then &#8220;Due Today \u672c\u65e5\u7d0d\u671f&#8221;<br \/>\nelse if Due Date &lt; = @now + 7 days then &#8220;Nearing Due Date \u7d0d\u671f\u8fd1\u3057&#8221;<br \/>\nelse &#8220;Upcoming \u4eca\u5f8c\u306e\u7d0d\u5165&#8221;<\/p>\n<p>\u30da\u30fc\u30b8\u306bJavaScript \u3092\u57cb\u3081\u8fbc\u307e\u305a\u306b\u3053\u3046\u3044\u3046\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u306f\u753b\u671f\u7684\u3060\u304c\u3001\u3000\u666e\u901a\u306eNotepad\u3067\u30a8\u30e9\u30fc\u3092\u51fa\u3055\u305a\u306b\u8a18\u8ff0\u3059\u308b\u306e\u306f\u307e\u305a\u4e0d\u53ef\u80fd\u3002JSON\u69cb\u6587\u306e\u30c1\u30a7\u30c3\u30af\u6a5f\u80fd\u3068\u30a8\u30ec\u30e1\u30f3\u30c8\u30d6\u30ed\u30c3\u30af\u306e\u6298\u308a\u305f\u305f\u307f\u6a5f\u80fd\u304c\u3057\u3063\u304b\u308a\u3064\u3044\u3066\u3044\u308bProgramming Editor\u306f\u5fc5\u9808\u3002\uff08\u7121\u6599\u3067\u4f7f\u3048\u308bVisual Studio Code\u304c\u3044\u307e\u3069\u304d\u306e\u65ec\u3067\u3059\u3002\uff09<\/p>\n<p>\u306a\u304a\u3001\u3053\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30bf\u30fc\u306fModern View \u306e\u307f\u3067\u6709\u52b9\u3002\u3000Classic View\u3067\u306f\u4f55\u3082\u8d77\u3053\u3089\u306a\u3044\u306e\u3067\u3000CSR\u3092\u4f7f\u3063\u305fJavaScript\u30b3\u30fc\u30c9\u306e\u5fc5\u8981\u6027\u304c\u306a\u304f\u306a\u3063\u305f\u3068\u3044\u3046\u308f\u3051\u3067\u306f\u306a\u3044\u3002\u3000\u307e\u305f\u3001\u3000\u5c06\u6765\u3078\u306e\u8a08\u753b\u306f\u3055\u308c\u3066\u3044\u308b\u3088\u3046\u3060\u304c\u3001WebPart\u3092\u4f7f\u3063\u3066\u30ea\u30b9\u30c8View\u3092\u30da\u30fc\u30b8\u306b\u57cb\u3081\u8fbc\u3093\u3060\u5834\u5408\u3082\u73fe\u6642\u70b9\u3067\u306f\u6a5f\u80fd\u3057\u306a\u3044\u3002<\/p>\n<p>\u6700\u521d\u306e\u884c\u306e&#8221;debugmode&#8221;: true\u306f\u8a18\u8ff0\u3057\u3066\u304a\u304f\u3068\u30a8\u30e9\u30fc\u306e\u5185\u5bb9\u304c\u30d6\u30e9\u30a6\u30b6\u30fc\u306e\u30c7\u30d9\u30ed\u30c3\u30d1\u30fc\u30b3\u30f3\u30bd\u30fc\u30eb\u3068\u30b3\u30e9\u30e0\u8868\u793a\u306b\u5410\u304d\u51fa\u3055\u308c\u308b\u306e\u3067\u30c7\u30d0\u30c3\u30b0\u7528\u306b\u4fbf\u5229\u3060\u304c\u3082\u3061\u308d\u3093\u524a\u9664\u3057\u3066\u3082\u304b\u307e\u308f\u306a\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SharePoint Online\u306e\u30c6\u30ca\u30f3\u30c8\u3067\u4e00\u30f6\u6708\u304f\u3089\u3044\u524d\u304b\u3089Push\u3055\u308c\u306f\u3058\u3081\u305f\u6a5f\u80fd\u306a\u306e\u3060\u304c\u3001\u30ea\u30b9\u30c8\u306e\u30b3\u30e9\u30e0\u30bb\u30c3\u30c6\u30a3\u30f3\u30b0\u306b\u201dColumn Formatting&#8221;\u3068\u3044\u3046\u306e\u304c\u8ffd\u52a0\u3055\u308c\u3066\u3044\u308b\u3002\u3000Text Entry Field \u306b\u306a\u3063\u3066\u304a\u308a\u3001\u8aac\u660e\u306f\u201dJSON\u66f8\u5f0f\u3067\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3092\u8a18\u5165\u3057\u3066\u304f\u3060\u3055\u3044\u201d\u3068\u304b\u306a\u308a\u305d\u3063\u3051\u306a\u3044\u3002\u3000\u8a73\u7d30\u306fOffice Dev\u306e\u307b\u3046\u306b\u3042\u308b\u3002\u3000\u3053\u3053\u3000\u3002 \u3055\u3089\u306b\u66f8\u5f0f\u30b5\u30f3\u30d7\u30eb\u306eDepository\u304cGitHUB\u306b\u304a\u3044\u3066\u3042\u308b\u3002\u3000\u3053\u3053 &nbsp; \u3067\u3001\u4e0a\u306e\u8a18\u8ff0\u3092\u53c2\u8003\u306bListView\u306e\u30ab\u30b9\u30bf\u30e0\u5316\u3092\u81ea\u5206\u3067\u8a66\u3057\u3066\u307f\u305f\u306e\u304c\u3053\u308c\u3002 \u3053\u3053\u3067\u306fChecked\u306eColumn Formatting \u306b\u4ee5\u4e0b\u3092\u6307\u5b9a { &#8220;debugMode&#8221;: true, &#8220;elmType&#8221;:&#8221;div&#8221;, &#8220;children&#8221;:[ { &#8220;elmType&#8221;: &#8220;img&#8221;, &#8220;attributes&#8221;: { &#8220;src&#8221;: { &#8220;operator&#8221;:&#8221;?&#8221;, &#8220;operands&#8221;:[ &#8220;@currentField&#8221;, &#8220;\/_layouts\/images\/CNSAPP16.GIF&#8221;, &#8220;\/_layouts\/images\/CbUnChecked.gif&#8221; ] }, &#8220;aria-hidden&#8221;:&#8221;true&#8221; }, &#8220;style&#8221;: { } } ] } \u3053\u308c\u3067Yes\/No\u306e\u6587\u5b57\u8868\u793a\u3092\u30a2\u30a4\u30b3\u30f3\u30a4\u30e1\u30fc\u30b8\u306b\u7f6e\u304d\u63db\u3048\u3066\u3044\u308b\u3002 Delivery Status\u306e\u30b3\u30e9\u30e0\u66f8\u5f0f\u306f\u3061\u3087\u3063\u3068\u9577\u304f\u306a\u308b\u3002\uff08\u53c2\u7167\u3059\u308b\u5404Column\u306e\u5185\u90e8\u540d\u79f0\u3092Column settings\u3067\u305d\u308c\u305e\u308c\u78ba\u8a8d\u3057\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308b\u3053\u3068\u306b\u6ce8\u610f\u3000\u4e0b\u306e\u4f8b\u3067\u306f\u3000Checked\u306fChecked\u3060\u304cDue Date\u306fTaskDueDate\u306b\u306a\u3063\u3066\u3044\u308b\uff09 { &#8220;debugMode&#8221;: true, &#8220;elmType&#8221;: &#8220;div&#8221;, &#8220;attributes&#8221;: { &#8220;class&#8221;: { &#8220;operator&#8221;: &#8220;?&#8221;, &#8220;operands&#8221;: [ &#8220;[$Checked]&#8221;, &#8220;sp-field-severity&#8211;good&#8221;, { &#8220;operator&#8221;: &#8220;?&#8221;, &#8220;operands&#8221;: [ { &#8220;operator&#8221;: &#8220;&lt;=&#8221;, &#8220;operands&#8221;: [ &#8220;[$TaskDueDate]&#8221;, { &#8220;operator&#8221;: &#8220;-&#8220;, &#8220;operands&#8221;: [ &#8220;@now&#8221;, 86400000 ] } ] }, &#8220;sp-field-severity&#8211;severeWarning&#8221;, { &#8220;operator&#8221;: &#8220;?&#8221;, &#8220;operands&#8221;: [ { &#8220;operator&#8221;: &#8220;&lt;=&#8221;, &#8220;operands&#8221;: [ &#8220;[$TaskDueDate]&#8221;, &#8220;@now&#8221; ] }, &#8220;sp-field-severity&#8211;blocked&#8221;, { &#8220;operator&#8221;: &#8220;?&#8221;, &#8220;operands&#8221;: [ { &#8220;operator&#8221;: &#8220;&lt;=&#8221;, &#8220;operands&#8221;: [ &#8220;[$TaskDueDate]&#8221;, { &hellip; <a href=\"https:\/\/www.a2life.info\/w\/?p=1689\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[],"class_list":["post-1689","post","type-post","status-publish","format-standard","hentry","category-sharepoint"],"_links":{"self":[{"href":"https:\/\/www.a2life.info\/w\/index.php?rest_route=\/wp\/v2\/posts\/1689","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.a2life.info\/w\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.a2life.info\/w\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.a2life.info\/w\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.a2life.info\/w\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1689"}],"version-history":[{"count":6,"href":"https:\/\/www.a2life.info\/w\/index.php?rest_route=\/wp\/v2\/posts\/1689\/revisions"}],"predecessor-version":[{"id":1696,"href":"https:\/\/www.a2life.info\/w\/index.php?rest_route=\/wp\/v2\/posts\/1689\/revisions\/1696"}],"wp:attachment":[{"href":"https:\/\/www.a2life.info\/w\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1689"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.a2life.info\/w\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1689"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.a2life.info\/w\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1689"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}