{"id":556,"date":"2017-10-31T13:01:26","date_gmt":"2017-10-31T17:01:26","guid":{"rendered":"https:\/\/www.ccrossan.com\/blog\/?p=556"},"modified":"2017-10-31T13:01:26","modified_gmt":"2017-10-31T17:01:26","slug":"un-approve-sharepoint-list-item-previous-versions","status":"publish","type":"post","link":"https:\/\/crossan007.dev\/blog\/microsoft-sharepoint\/un-approve-sharepoint-list-item-previous-versions\/","title":{"rendered":"Un-Approve SharePoint List Item Previous Versions"},"content":{"rendered":"\n<div class=\"twitter-share\"><a href=\"https:\/\/twitter.com\/intent\/tweet?via=crossan007\" class=\"twitter-share-button\">Tweet<\/a><\/div>\n<p>I recently had a change request against a SharePoint Forms Library I had created a few years ago &#8211; the request was to adjust the permissions so that form submitters could see only the forms that they&#8217;ve submitted (and not others).<\/p>\n<p>This is a generally straightforward action on new libraries: enable<strong> &#8221; Require content approval for submitted items?&#8221;,\u00a0<\/strong>and change <strong>&#8220;Who should see draft items in this document library?&#8221;\u00a0<\/strong>to<em> &#8220;<label for=\"onetidMinorApprover\">Only users who can approve items (and the author of the item)&#8221;<\/label><\/em><\/p>\n<p>However, enabling these settings seems to have caused the items that already existed to have an Approval Status of &#8220;Approved, &#8221; despite a pending Approval workflow.\u00a0 This caused the undesired effect of allowing users who do not hold the &#8220;Approve&#8221; permission level to access <span style=\"text-decoration: underline;\">a\u00a0<em>previous version<\/em><\/span> of items still in the approval workflow.<\/p>\n<p><strong>I needed to reject previous versions of forms where the current version had not yet been approved.\u00a0<span style=\"text-decoration: underline;\"> On lots of items.<\/span><\/strong><\/p>\n<p>I found numerous examples from google how to <a href=\"http:\/\/www.sharepointdiary.com\/2015\/06\/approve-list-items-using-powershell-in-sharepoint.html\">use PowerShell to set the Approval Status of list items<\/a>; however, nearly every example dealt with only the current version of a list item &#8211; making no mention of altering the approval status of previous versions of list items.<\/p>\n<p>Additionally, I found a few posts attempting to manipulate attributes for previous versions;\u00a0 the responses for each of these inquires were varied:<\/p>\n<ul>\n<li>&#8220;you can&#8217;t &#8211; history is read-only,&#8221;\n<ul>\n<li><a href=\"https:\/\/social.msdn.microsoft.com\/Forums\/sqlserver\/en-US\/a6677100-3133-4d83-acf4-25ef08998619\/sharepoint-programmatically-update-elements-that-stays-in-previous-versions-is-it-possible?forum=sharepointdevelopment\">Link<\/a><\/li>\n<li><a href=\"https:\/\/stackoverflow.com\/questions\/8399244\/sharepoint-how-to-update-a-splistitemversions-property\">Link<\/a><\/li>\n<\/ul>\n<\/li>\n<li>&#8220;you can migrate the documents to a new list, and re-build the history&#8221;\n<ul>\n<li><a href=\"https:\/\/social.msdn.microsoft.com\/Forums\/office\/en-US\/70400ac7-bb0e-4353-ac36-990133b04447\/how-to-update-the-system-generated-fields-such-as-created-created-by-modified-modified-by-and?forum=sharepointdevelopment#205f884c-0dfb-4ed7-bdb8-4f273e5742e0\">Link<\/a><\/li>\n<\/ul>\n<\/li>\n<li>&#8220;you can delete the old versions&#8221;\n<ul>\n<li><a href=\"https:\/\/gallery.technet.microsoft.com\/office\/Delete-all-previous-file-fd1ba18a\">Link<\/a><\/li>\n<li><a href=\"http:\/\/www.sharepointdiary.com\/2011\/01\/limit-versioning-and-delete-old-versions-in-sharepoint.html\">Link<\/a><\/li>\n<li>Link<\/li>\n<li><a href=\"https:\/\/sharepoint.stackexchange.com\/questions\/160440\/remove-all-versions-from-a-single-site-document-library-in-sharepoint-2007\">Link<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>I even found a mega-thread on TechNet how to <a href=\"https:\/\/social.technet.microsoft.com\/wiki\/contents\/articles\/19104.sharepoint-2010-list-and-delete-list-item-versions-using-powershell.aspx\">&#8220;List and Delete List Item Versions using PowerShell,&#8221;\u00a0<\/a>and a\u00a0<a href=\"https:\/\/social.technet.microsoft.com\/wiki\/contents\/articles\/20831.sharepoint-a-complete-guide-to-getting-and-setting-fields-using-powershell.aspx#Set_and_Get_a_Text_Field\">&#8220;Complete Guide to Getting and Setting Fields Using PowerShell&#8221;<\/a><\/p>\n<p>None of these options accomplished what I was seeking:\u00a0 to simply remove the approval on previous versions.<\/p>\n<p>Finally, I resorted to simply poking at the objects from PowerShell (never under-estimate the power of <a href=\"https:\/\/technet.microsoft.com\/en-us\/library\/ee176854.aspx\">Get-Member <\/a>to explore objects) Attempting to modify the properties on a previous version would yeild the error message &#8220;Unable to index into an object of type Microsoft.SharePoint.SPListItemVersion&#8221; (<a href=\"https:\/\/sharepoint.stackexchange.com\/questions\/163456\/error-unable-to-index-into-an-object-of-type-microsoft-sharepoint-splistitemv\">Link)<\/a><\/p>\n<p>Ok &#8211; different approach:\u00a0 I <strong>k<\/strong><strong>now<\/strong>\u00a0my desired action is feasible via the UI for\u00a0<em>single list items:<\/em><\/p>\n<p><img src=\"https:\/\/pbs.twimg.com\/media\/DNeADXiW0AMZzEw.jpg\" \/><\/p>\n<p>So, I opened Chrome developer tools and captured the command sent when clicking &#8220;Reject this version&#8221;: <strong>A POST to &#8220;\/_layouts\/versions.aspx&#8221; with the ItemID, and an &#8220;op&#8221; value of &#8220;TakeOffline&#8221;.\u00a0<\/strong>A quick google search revealed a server-side object model equilavent:\u00a0<a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/microsoft.sharepoint.spfile.takeoffline.aspx\">Microsoft.SharePoint.SPFile.TakeOffline<\/a><\/p>\n<p>My solution: invoke SPListItem.File.TakeOffline() for every file which is currently pending and has a previously approved version:<\/p>\n<div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/crossan007\/76b62e4c0b1838fe2f6455e4a9bb98c7.js\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/crossan007\/76b62e4c0b1838fe2f6455e4a9bb98c7\">Gist<\/a>.<\/noscript><\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently had a change request against a SharePoint Forms Library I had created a few years ago &#8211; the request was to adjust the permissions so that form submitters could see only the forms that they&#8217;ve submitted (and not others). This is a generally straightforward action on new libraries: enable &#8221; Require content approval &hellip; <a href=\"https:\/\/crossan007.dev\/blog\/microsoft-sharepoint\/un-approve-sharepoint-list-item-previous-versions\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Un-Approve SharePoint List Item Previous Versions<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[14],"tags":[29,10],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v17.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/crossan007.dev\/blog\/microsoft-sharepoint\/un-approve-sharepoint-list-item-previous-versions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Un-Approve SharePoint List Item Previous Versions - Charles&#039; Blog\" \/>\n<meta property=\"og:description\" content=\"I recently had a change request against a SharePoint Forms Library I had created a few years ago &#8211; the request was to adjust the permissions so that form submitters could see only the forms that they&#8217;ve submitted (and not others). This is a generally straightforward action on new libraries: enable &#8221; Require content approval &hellip; Continue reading Un-Approve SharePoint List Item Previous Versions &rarr;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/crossan007.dev\/blog\/microsoft-sharepoint\/un-approve-sharepoint-list-item-previous-versions\/\" \/>\n<meta property=\"og:site_name\" content=\"Charles&#039; Blog\" \/>\n<meta property=\"article:published_time\" content=\"2017-10-31T17:01:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/pbs.twimg.com\/media\/DNeADXiW0AMZzEw.jpg\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"crossan007\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/crossan007.dev\/blog\/#website\",\"url\":\"https:\/\/crossan007.dev\/blog\/\",\"name\":\"Charles&#039; Blog\",\"description\":\"SharePoint | PowerShell | Exchange | SCCM | Ubuntu | PHP | JavaScript | A\/V Live Production | More...\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/crossan007.dev\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/crossan007.dev\/blog\/microsoft-sharepoint\/un-approve-sharepoint-list-item-previous-versions\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/pbs.twimg.com\/media\/DNeADXiW0AMZzEw.jpg\",\"contentUrl\":\"https:\/\/pbs.twimg.com\/media\/DNeADXiW0AMZzEw.jpg\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/crossan007.dev\/blog\/microsoft-sharepoint\/un-approve-sharepoint-list-item-previous-versions\/#webpage\",\"url\":\"https:\/\/crossan007.dev\/blog\/microsoft-sharepoint\/un-approve-sharepoint-list-item-previous-versions\/\",\"name\":\"Un-Approve SharePoint List Item Previous Versions - Charles&#039; Blog\",\"isPartOf\":{\"@id\":\"https:\/\/crossan007.dev\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/crossan007.dev\/blog\/microsoft-sharepoint\/un-approve-sharepoint-list-item-previous-versions\/#primaryimage\"},\"datePublished\":\"2017-10-31T17:01:26+00:00\",\"dateModified\":\"2017-10-31T17:01:26+00:00\",\"author\":{\"@id\":\"https:\/\/crossan007.dev\/blog\/#\/schema\/person\/bd99569cd81332c8fd866d023848b979\"},\"breadcrumb\":{\"@id\":\"https:\/\/crossan007.dev\/blog\/microsoft-sharepoint\/un-approve-sharepoint-list-item-previous-versions\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/crossan007.dev\/blog\/microsoft-sharepoint\/un-approve-sharepoint-list-item-previous-versions\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/crossan007.dev\/blog\/microsoft-sharepoint\/un-approve-sharepoint-list-item-previous-versions\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/crossan007.dev\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Un-Approve SharePoint List Item Previous Versions\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/crossan007.dev\/blog\/#\/schema\/person\/bd99569cd81332c8fd866d023848b979\",\"name\":\"crossan007\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/crossan007.dev\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/fff72c74fb6a0da29accf0db83ad4b4b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/fff72c74fb6a0da29accf0db83ad4b4b?s=96&d=mm&r=g\",\"caption\":\"crossan007\"},\"url\":\"https:\/\/crossan007.dev\/blog\/author\/crossan007\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/crossan007.dev\/blog\/microsoft-sharepoint\/un-approve-sharepoint-list-item-previous-versions\/","og_locale":"en_US","og_type":"article","og_title":"Un-Approve SharePoint List Item Previous Versions - Charles&#039; Blog","og_description":"I recently had a change request against a SharePoint Forms Library I had created a few years ago &#8211; the request was to adjust the permissions so that form submitters could see only the forms that they&#8217;ve submitted (and not others). This is a generally straightforward action on new libraries: enable &#8221; Require content approval &hellip; Continue reading Un-Approve SharePoint List Item Previous Versions &rarr;","og_url":"https:\/\/crossan007.dev\/blog\/microsoft-sharepoint\/un-approve-sharepoint-list-item-previous-versions\/","og_site_name":"Charles&#039; Blog","article_published_time":"2017-10-31T17:01:26+00:00","og_image":[{"url":"https:\/\/pbs.twimg.com\/media\/DNeADXiW0AMZzEw.jpg"}],"twitter_misc":{"Written by":"crossan007","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/crossan007.dev\/blog\/#website","url":"https:\/\/crossan007.dev\/blog\/","name":"Charles&#039; Blog","description":"SharePoint | PowerShell | Exchange | SCCM | Ubuntu | PHP | JavaScript | A\/V Live Production | More...","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/crossan007.dev\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https:\/\/crossan007.dev\/blog\/microsoft-sharepoint\/un-approve-sharepoint-list-item-previous-versions\/#primaryimage","inLanguage":"en-US","url":"https:\/\/pbs.twimg.com\/media\/DNeADXiW0AMZzEw.jpg","contentUrl":"https:\/\/pbs.twimg.com\/media\/DNeADXiW0AMZzEw.jpg"},{"@type":"WebPage","@id":"https:\/\/crossan007.dev\/blog\/microsoft-sharepoint\/un-approve-sharepoint-list-item-previous-versions\/#webpage","url":"https:\/\/crossan007.dev\/blog\/microsoft-sharepoint\/un-approve-sharepoint-list-item-previous-versions\/","name":"Un-Approve SharePoint List Item Previous Versions - Charles&#039; Blog","isPartOf":{"@id":"https:\/\/crossan007.dev\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/crossan007.dev\/blog\/microsoft-sharepoint\/un-approve-sharepoint-list-item-previous-versions\/#primaryimage"},"datePublished":"2017-10-31T17:01:26+00:00","dateModified":"2017-10-31T17:01:26+00:00","author":{"@id":"https:\/\/crossan007.dev\/blog\/#\/schema\/person\/bd99569cd81332c8fd866d023848b979"},"breadcrumb":{"@id":"https:\/\/crossan007.dev\/blog\/microsoft-sharepoint\/un-approve-sharepoint-list-item-previous-versions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/crossan007.dev\/blog\/microsoft-sharepoint\/un-approve-sharepoint-list-item-previous-versions\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/crossan007.dev\/blog\/microsoft-sharepoint\/un-approve-sharepoint-list-item-previous-versions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/crossan007.dev\/blog\/"},{"@type":"ListItem","position":2,"name":"Un-Approve SharePoint List Item Previous Versions"}]},{"@type":"Person","@id":"https:\/\/crossan007.dev\/blog\/#\/schema\/person\/bd99569cd81332c8fd866d023848b979","name":"crossan007","image":{"@type":"ImageObject","@id":"https:\/\/crossan007.dev\/blog\/#personlogo","inLanguage":"en-US","url":"https:\/\/secure.gravatar.com\/avatar\/fff72c74fb6a0da29accf0db83ad4b4b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/fff72c74fb6a0da29accf0db83ad4b4b?s=96&d=mm&r=g","caption":"crossan007"},"url":"https:\/\/crossan007.dev\/blog\/author\/crossan007\/"}]}},"_links":{"self":[{"href":"https:\/\/crossan007.dev\/blog\/wp-json\/wp\/v2\/posts\/556"}],"collection":[{"href":"https:\/\/crossan007.dev\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/crossan007.dev\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/crossan007.dev\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/crossan007.dev\/blog\/wp-json\/wp\/v2\/comments?post=556"}],"version-history":[{"count":3,"href":"https:\/\/crossan007.dev\/blog\/wp-json\/wp\/v2\/posts\/556\/revisions"}],"predecessor-version":[{"id":560,"href":"https:\/\/crossan007.dev\/blog\/wp-json\/wp\/v2\/posts\/556\/revisions\/560"}],"wp:attachment":[{"href":"https:\/\/crossan007.dev\/blog\/wp-json\/wp\/v2\/media?parent=556"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/crossan007.dev\/blog\/wp-json\/wp\/v2\/categories?post=556"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/crossan007.dev\/blog\/wp-json\/wp\/v2\/tags?post=556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}