{"id":1852,"date":"2017-08-28T15:42:04","date_gmt":"2017-08-28T13:42:04","guid":{"rendered":"https:\/\/blog.kodono.info\/wordpress\/?p=1852"},"modified":"2018-08-09T10:47:29","modified_gmt":"2018-08-09T08:47:29","slug":"overwrite-the-created-field-for-a-sharepoint-list-item","status":"publish","type":"post","link":"https:\/\/blog.kodono.info\/wordpress\/2017\/08\/28\/overwrite-the-created-field-for-a-sharepoint-list-item\/","title":{"rendered":"Overwrite the Created field for a Sharepoint list item"},"content":{"rendered":"<p>Sharepoint provides automatic fields, like &#8220;Created&#8221; that contains the creation date of a list item. It&#8217;s a readonly field.<\/p>\n<p>You could use a webservice to change the <code>ReadOnly<\/code> property in order to overwrite its value.<\/p>\n<p>Using <a href=\"http:\/\/aymkdn.github.io\/SharepointPlus\/\">SharepointPlus<\/a> the code is:<\/p>\n<pre class=\"brush:javascript\">\r\n\/\/ don't change the below information\r\n\/\/ the details about this field are found using $SP().list().info\r\nvar updateSystemFields = \"<Fields>\" +\r\n    '<Method ID=\"1\">' +\r\n    '<Field ID=\"{8c06beca-0777-48f7-91c7-6da68bc07b69}\" Name=\"Created\" SourceID=\"http:\/\/schemas.microsoft.com\/sharepoint\/v3\" StaticName=\"Created\" Group=\"_Hidden\" ColName=\"tp_Created\" RowOrdinal=\"0\" ReadOnly=\"FALSE\" Type=\"DateTime\" DisplayName=\"Created\" StorageTZ=\"TRUE\">' +\r\n    \"<\/Field><\/Method>\" +\r\n    \"<\/Fields>\";\r\n\/\/ send the request to the server\r\n$SP().webService({\r\n  webURL: \"https:\/\/website.url.com\/\",\r\n  service: \"Lists\",\r\n  operation:\"UpdateList\",\r\n  properties:{\r\n    listName: \"Name of the list\",\r\n    listProperties: \"\",\r\n    updateFields: updateSystemFields,\r\n    newFields: \"\",\r\n    deleteFields: \"\",\r\n    listVersion: \"\",\r\n  }\r\n})\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Sharepoint provides automatic fields, like &#8220;Created&#8221; that contains the creation date of a list item. It&#8217;s a readonly field. You could use a webservice to change the ReadOnly property in order to overwrite its value. Using SharepointPlus the code is: \/\/ don&#8217;t change the below information \/\/ the details about this field are found using [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","hide_page_title":"","footnotes":""},"categories":[170,13,33],"tags":[123,24,152,158],"class_list":["post-1852","post","type-post","status-publish","format-standard","hentry","category-english","category-niveau-intermediaire","category-programmation","tag-english","tag-javascript","tag-niveau-intermediaire","tag-programmation"],"_links":{"self":[{"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/posts\/1852","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/comments?post=1852"}],"version-history":[{"count":4,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/posts\/1852\/revisions"}],"predecessor-version":[{"id":1910,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/posts\/1852\/revisions\/1910"}],"wp:attachment":[{"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/media?parent=1852"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/categories?post=1852"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/tags?post=1852"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}