Investigating a Busted SharePoint Version History

Have you ever tried to view a document’s SharePoint version history and an error appears? I was recently performing a migration and each library that I was moving had this problem. I checked the migration logs and the versions were successfully copied over. Running the migration again didn’t solve the problem and neither did changing the configuration settings. I started to research the issue and came across very few forums where others were experiencing the same issue and there were several potential solutions with mixed results. In this post, I’ll walk through my specific issue, how I identified it, and the solutions that I found.

The Issue

I was finding that a lot of people were seeing this issue when performing their own migrations and it was starting to seem like the issue was caused by the migration tool but upon further investigation, I don’t believe that the broken version history is caused by the tool. Instead, the issue appears to be related to Custom Scripting being disabled. Allowing custom scripting is a way to allow people to change the look and feel of a page and it’s not a big deal to have it disabled. In my case however, this appeared to be the source of my issue. This and the fact that I’m working with 2 very locked down environments and the tools that I’m using can’t be granted the recommended permissions.

Advertisementshttps://c0.pubmine.com/sf/0.0.3/html/safeframe.htmlREPORT THIS ADPRIVACY

So what is happening when custom scripting is disabled?

When custom scripting is disabled and a migration is performed, all of your content is migrated over but when the library’s Display Form (dispform.aspx) is created, the disabled custom scripting is preventing the xml from being inserted into the display form. You can verify that the web part is missing by visiting the library’s display form directly and then editing the page. The URL should follow the same format seen here: https://<your site>/<your library>/Forms/Dispform.aspx. When you edit this web part page, if it appears to be empty, then that is why your version history isn’t working.

Why would a broken display form affect my version history?

Advertisementshttps://c0.pubmine.com/sf/0.0.3/html/safeframe.htmlREPORT THIS ADPRIVACY

The version history page has a dependency on display form’s list view web part and if it’s missing that’s when you see the error.

A Simple Solution

The simple solution is to enable custom scripting. Microsoft Docs has details around allowing or preventing custom scripts. In my case, we will be running the following command on each site that was affected, running the migration again, and then restoring the setting after we’re done making corrections. Setting the value to 0 allows custom scripts and setting it to 1 prevents them.

Set-SPOSite -DenyAddAndCustomizePages 0

One final thought – The list form web part isn’t one that can be selected an added to a web part zone. In the past, you would either edit the page with SharePoint Designer or create a simple console app that adds the web part XML into the page. If you performed a lot of migrations, depending on the migration tool that you’re using, it might be cumbersome to go back and re-run an old job. In that case, if you have the ability to run a PowerShell script, you may opt to write a script that will target all of the affected libraries. In the next post, I will walk you through what this script might look like.

This blog is part of SharePoint Week. For more great content, click here

About the Author:

Working almost exclusively as a SharePoint Developer/Consultant since 2005. I’ve been involved in a variety of projects for many clients in various industries. I’ve had the opportunity to work with all versions of SharePoint throughout my career. My work has taken me to projects in Virginia, DC, Maryland, New Jersey, New York, and my home, Philadelphia. I am the organizer of the Tri-State Office 365 User Group and SharePoint Saturday Philly.

Reference:

Rivera, J. (2021). Investigating a Busted SharePoint Version History. Available at: https://sharepointlessons.wordpress.com/2021/07/06/investigating-a-busted-sharepoint-version-history/ [Accessed: 12th September 2021].

Share this on...

Rate this Post:

Share:

Topics:

SharePoint

Tags: