{"id":1265,"date":"2011-08-21T11:48:30","date_gmt":"2011-08-21T09:48:30","guid":{"rendered":"http:\/\/www.itidea.nl\/?p=1265"},"modified":"2015-09-08T20:37:09","modified_gmt":"2015-09-08T18:37:09","slug":"how-to-retrieve-document-set-version-history","status":"publish","type":"post","link":"https:\/\/www.itidea.nl\/index.php\/how-to-retrieve-document-set-version-history\/","title":{"rendered":"How to retrieve document set version history"},"content":{"rendered":"<p>Document set versions are slightly different than item versions. Document sets can be managed by a separate ribbon tab called Document Set and group called Manage.<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2011\/08\/DocSetHistory01Ribbon.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1272\" title=\"DocSetHistory01Ribbon\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2011\/08\/DocSetHistory01Ribbon.png\" alt=\"\" width=\"467\" height=\"137\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2011\/08\/DocSetHistory01Ribbon.png 467w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2011\/08\/DocSetHistory01Ribbon-300x88.png 300w\" sizes=\"auto, (max-width: 467px) 100vw, 467px\" \/><\/a><\/p>\n<p>To create a version of a document set the action Capture Version in this part of the ribbon has to be selected. When selecting the following screen will be shown:<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2011\/08\/DocSetHistory02Version.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1273\" title=\"DocSetHistory02Version\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2011\/08\/DocSetHistory02Version.png\" alt=\"\" width=\"613\" height=\"377\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2011\/08\/DocSetHistory02Version.png 613w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2011\/08\/DocSetHistory02Version-300x184.png 300w\" sizes=\"auto, (max-width: 613px) 100vw, 613px\" \/><\/a><\/p>\n<p>To use versioning of a document set (and items) versioning has to be enabled on the library.\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>After selecting a version option (when major\/minor enabled), adding some comment and selecting the Ok button a document set version is created. To view the versions of the document set the action Version History can be selected in the ribbon.<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2011\/08\/DocSetHistory03VersionHistory.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1274\" title=\"DocSetHistory03VersionHistory\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2011\/08\/DocSetHistory03VersionHistory.png\" alt=\"\" width=\"508\" height=\"374\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2011\/08\/DocSetHistory03VersionHistory.png 508w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2011\/08\/DocSetHistory03VersionHistory-300x220.png 300w\" sizes=\"auto, (max-width: 508px) 100vw, 508px\" \/><\/a><\/p>\n<p>In this screen the first column displayed is No. This is not the regular version column of the library, but a totally different one. When creating a document set version the version column of the library doesn&#8217;t change, only the No value.\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>That&#8217;s nice, but where is the version of the document set actually stored?\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>The version(s) of a document set are stored in the propertybag of the item itself.\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>To analyze settings I always start up PowerShell first to check on things. Just because it&#8217;s quick and easy. When I get what I want from PowerShell it&#8217;s easily turned into C# code. I followed the same procedure to get to the storage of document set versions. Since I couldn&#8217;t find the version anywhere in the UI, my first guess was checking the propertybag keys.\u00a0\u00a0\u00a0\u00a0<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\n$site=Get-SPSite &quot;http:\/\/sp2010dev&quot;\r\n$docList = $site.RootWeb.Lists.TryGetList(&quot;Documents&quot;);\r\n$item = $docList.Items.GetItemById(2)\r\n$prop = $item.Properties\r\n<\/pre>\n<p>Often I use PowerGui Script Editor which gives an excellent overview of variables:\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>The keys:<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2011\/08\/DocSetHistory04ItemKeys.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1275\" title=\"DocSetHistory04ItemKeys\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2011\/08\/DocSetHistory04ItemKeys.png\" alt=\"\" width=\"522\" height=\"406\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2011\/08\/DocSetHistory04ItemKeys.png 522w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2011\/08\/DocSetHistory04ItemKeys-300x233.png 300w\" sizes=\"auto, (max-width: 522px) 100vw, 522px\" \/><\/a><\/p>\n<p>And the values:<br \/>\n<a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2011\/08\/DocSetHistory05ItemValues.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1276\" title=\"DocSetHistory05ItemValues\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2011\/08\/DocSetHistory05ItemValues.png\" alt=\"\" width=\"648\" height=\"344\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2011\/08\/DocSetHistory05ItemValues.png 648w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2011\/08\/DocSetHistory05ItemValues-300x159.png 300w\" sizes=\"auto, (max-width: 648px) 100vw, 648px\" \/><\/a><\/p>\n<p>While scrolling through the property keys I noticed a key named snapshots. By checking out the value of that key I knew I found it!\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>The following PowerShell command can be used to get the value of the snapshot key:\u00a0\u00a0\u00a0\u00a0<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\n$item.Properties.get_Item(&quot;snapshots&quot;)\r\n<\/pre>\n<p>The version history is stored in xml:\u00a0\u00a0\u00a0\u00a0<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;SnapshotCollection NextSnapshotNumber=&quot;3&quot; NextInternalId=&quot;1&quot;&gt;\r\n  &lt;Items \/&gt;\r\n  &lt;Snapshots&gt;\r\n    &lt;Snapshot Label=&quot;2&quot; Major=&quot;True&quot; Created=&quot;08\/21\/2011 07:50:56&quot; By=&quot;username&quot;&gt;\r\n      &lt;Comments&gt;Another version of the document set.&lt;\/Comments&gt;\r\n      &lt;Fields&gt;\r\n        &lt;Field Id=&quot;8553196d-ec8d-4564-9861-3dbe931050c8&quot;&gt;Document set name&lt;\/Field&gt;\r\n        &lt;Field Id=&quot;fa564e0f-0c70-4ab9-b863-0177e6ddd247&quot;&gt;Document set name&lt;\/Field&gt;\r\n        &lt;Field Id=&quot;cbb92da4-fd46-4c7d-af6c-3128c2a5576e&quot;&gt;Add a description here.&lt;\/Field&gt;\r\n      &lt;\/Fields&gt;\r\n      &lt;SnapshotItems \/&gt;\r\n    &lt;\/Snapshot&gt;\r\n    &lt;Snapshot Label=&quot;1&quot; Major=&quot;True&quot; Created=&quot;08\/21\/2011 07:50:20&quot; By=&quot;username&quot;&gt;\r\n      &lt;Comments&gt;This is the first version of this document set.&lt;\/Comments&gt;\r\n      &lt;Fields&gt;\r\n        &lt;Field Id=&quot;8553196d-ec8d-4564-9861-3dbe931050c8&quot;&gt;Document set name&lt;\/Field&gt;\r\n        &lt;Field Id=&quot;fa564e0f-0c70-4ab9-b863-0177e6ddd247&quot;&gt;Document set name&lt;\/Field&gt;\r\n        &lt;Field Id=&quot;cbb92da4-fd46-4c7d-af6c-3128c2a5576e&quot; \/&gt;\r\n      &lt;\/Fields&gt;\r\n      &lt;SnapshotItems \/&gt;\r\n    &lt;\/Snapshot&gt;\r\n  &lt;\/Snapshots&gt;\r\n&lt;\/SnapshotCollection&gt;\r\n<\/pre>\n<p>\u00a0\u00a0\u00a0<\/p>\n<p>The Snapshot element with Label attribute 1 is the first version. The comment is displayed and the fields and values of the document set.\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>The Snapshot element with Label attribute 2 is the second version. The same items are displayed with the addition of the value of the description \u2018Add a description here\u2019. That\u2019s what I changed before creating the second version.\u00a0\u00a0\u00a0\u00a0<\/p>\n<p>The attribute NextSnapshotNumber holds the value of the version number that will be created when creating another version, 3 in this case.\u00a0\u00a0\u00a0\u00a0<\/p>\n<h3>Summary\u00a0\u00a0<\/h3>\n<p>Document set versions are different than regular item versions. The version history of a document set is stored in the propertybag of the document set itself as xml.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Document set versions are slightly different than item versions. Document sets can be managed by a separate ribbon tab called Document Set and group called Manage. To create a version of a document set the action Capture Version in this &#8230; <a class=\"more-link\" href=\"https:\/\/www.itidea.nl\/index.php\/how-to-retrieve-document-set-version-history\/\">Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[43,42],"class_list":["post-1265","post","type-post","status-publish","format-standard","hentry","category-sharepoint-2010","tag-powershell","tag-sharepoint-2010"],"_links":{"self":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/1265","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/comments?post=1265"}],"version-history":[{"count":9,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/1265\/revisions"}],"predecessor-version":[{"id":1279,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/1265\/revisions\/1279"}],"wp:attachment":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/media?parent=1265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/categories?post=1265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/tags?post=1265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}