Minimal download strategy (MDS) in SharePoint

This SharePoint tutorial, we will discuss Minimal download strategy (MDS) in SharePoint. What are the advantages of using Minimal download strategy (MDS) in SharePoint 2016 or SharePoint 2013? How we can enable MDS in SharePoint 2016.

Also, we will see how we can enable Minimal download strategy (MDS) in SharePoint 2016/2013 using PowerShell, Server object model and also we will discuss how to enable Minimal download strategy (MDS) using .Net managed object model code (CSOM).

What is SharePoint Minimal Download Strategy?

MDS stands for Minimal Download Strategy it improves page load time and reduces the amount of data that the browser has to download when users navigate from one page to another in a SharePoint site.

It delivers a faster and more fluid page navigation experience, pages and site templates that support it, by downloading and rendering only those portions of a page that are changing. You can identify a site that has MDS enabled by looking at the URL.

An MDS-enabled site has the _layouts/15/start.aspx page in the URL followed by a hash mark ( # ) and the relative URL of the requested resource.

For an example, a non-MDS-formatted URL looks like this:

 http://win-6haivopgi9b:28320/sites/myteamsite/SitePages/Home.aspx

Whereas MDS enabled URL looks like:

http://win-6haivopgi9b:28320/sites/myteamsite/_layouts/15/start.aspx#/SitePage/Home.aspx

How Minimal download strategy (MDS) Works in SharePoint?

The basic working mechanism is, SharePoint MDS works on two engines, one in the server and another in the client. Client Processes only the differences (or delta) between the current page and the requested page that work together to calculate the changes and render the pages in the browser when the user navigates from page to page on the SharePoint site.

In simple words, by enabling this feature we get the changed areas on the current page replaced with the new page content instead of hitting the server for a full-page, which serves faster page navigation.

minimal download strategy sharepoint 2016
minimal download strategy sharepoint 2016

As shown in the figure we are going to discuss on the changes on pages after enabling MDS as numbered in figure.

  1. The browser requests the changes between the current page and a new one in the SharePoint site.
  2. The MDS engine in the server calculates the delta between the current and the new pages.
  3. The MDS engine in the server sends the delta to the MDS engine in the client.
  4. The MDS engine in the client replaces the changed areas on the current page with the new page content.

This serves the same page as exactly as it would have been if the page had been downloaded without MDS.

The MDS engine in the server sends the information back to the client. This information can contain HTML with embedded scripts and styles, XML, or JavaScript Object Notation (JSON).

Enable Minimal download strategy (MDS) in SharePoint

There are different ways to enable SharePoint Minimal download strategy (MDS). We can enable a Minimal download strategy (MDS):

  • From Site Features Page
  • PowerShell
  • SharePoint Server Object Model
  • Client Object Model (CSOM)

Enable Minimal download strategy (MDS) feature using Site Settings page

We can enable or disable Minimal download strategy (MDS) from the site settings page itself. Minimal download strategy (MDS) comes as a feature in the SharePoint 2016/2019/2013/Online site.

Open SharePoint site for which you want to enable or disable the feature and click on the gear icon from the right corner and then select site settings.

minimal download strategy sharepoint 2013
minimal download strategy sharepoint 2013

Then click on “Manage site features” which is under Site Actions.

minimal download strategy sharepoint online
minimal download strategy sharepoint online

The search for “Minimal Download Strategy” and click on Activate button to active the feature and click on Deativate to deactivate the feature.

disable minimal download strategy sharepoint 2013 powershell
disable minimal download strategy sharepoint 2013 powershell

If Minimal download strategy (MDS) is disabled then the URL will looks like below:

how to Disable Minimal Download Strategy (MDS) in SharePoint 2013
how to Disable Minimal Download Strategy (MDS) in SharePoint 2013

Once you enable the feature the url will looks like below:

deactivate minimal download strategy feature in site settings
deactivate minimal download strategy feature in site settings

Enable Minimal download strategy (MDS) using PowerShell in SharePoint

We can enable or disable Minimal download strategy (MDS) using PowerShell in SharePoint 2016/2013. You can run, debug and test the PowerShell script using Visual studio code or by using Windows PowerShell ISE.

Enable Minimal download strategy (MDS)

MDS is a feature which we need to activate using PowerShell. The feature name is “MDSFeature“.

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
#SharePoint site URL
$WebURL ="http://win-6haivopgi9b:28320/sites/myteamsite"
Enable-SPFeature –identity "MDSFeature" -URL $WebURL -confirm:$false

Disable Minimal download strategy (MDS):

Below is the PowerShell Script to disable MDS.

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
#SharePoint site URL
$WebURL ="http://win-6haivopgi9b:28320/sites/myteamsite"
Disable-SPFeature –identity "MDSFeature" -URL $WebURL -confirm:$false

Enable/Disable Minimal download strategy (MDS) using server object model in SharePoint

We can use SharePoint 2016/2013 server object model code to enable or disable the Minimal download strategy (MDS) feature.

Enable Minimal download strategy (MDS):

To enable MDS to make EnableMinimalDownload property of Web to true in the SharePoint server object model code.

SPWeb web = new SPSite("http://win-6haivopgi9b:28320/sites/myteamsite/").OpenWeb();
web.EnableMinimalDownload = true;
web.Update();
Lbl1.Text = "successful";

Disable Minimal download strategy (MDS):

By using the SharePoint server object model code, we can disable the minimal download strategy feature of SharePoint. To disable MDS make EnableMinimalDownload property of Web to false.

SPWeb web = new SPSite("http://win-6haivopgi9b:28320/sites/myteamsite/").OpenWeb();
web.EnableMinimalDownload = false;
web.Update();
Lbl1.Text = "successful";

Enable/Disable Minimal download strategy (MDS) using client object type model in SharePoint 2016

We can enable SharePoint Minimal download strategy (MDS) using the client object model code. Here you can write C#.Net code using Microsoft Visual Studio 2017.

Enable Minimal download strategy (MDS):

We can enable Minimal download strategy (MDS) by setting EnableMinimalDownload of the web to true in the CSOM code.

using (ClientContext context = new ClientContext("http://win-6haivopgi9b:28320/sites/myteamsite"))
{
Web web = context.Web;
web.EnableMinimalDownload = true;
web.Update();
context.ExecuteQuery();
lbl1.Text = "successful";
}

Disable Minimal download strategy (MDS):

We can disable Minimal download strategy (MDS) by setting the EnableMinimalDownload of the web to false in the SharePoint client object model.

using (ClientContext context = new ClientContext("http://win-6haivopgi9b:28320/sites/myteamsite"))
{
Web web = context.Web;
web.EnableMinimalDownload = false;
web.Update();
context.ExecuteQuery();
lbl1.Text = "successful";
}

Read some SharePoint tutorials:

In this SharePoint tutorial, we discussed, Minimal download strategy (MDS) in SharePoint 2016/2013 or SharePoint Online. Also, we discussed, how to enable/disable MDS using PowerShell, Server, and client object model code.

>