3

I have to deactivate the MDS when provisioning my sites. I have tried with an event receiver in a custom feature but it seems that when I execute this code in the receiver

Guid featureGuid = new Guid("87294C72-F260-42f3-A41B-981A2FFCE37A");
if (mySiteWeb.Features[featureGuid] != null)
{
     mySiteWeb.Features.Remove(featureGuid);
}

nothing is happenning.

This only works once the my site is created and throughout the User Interface. If I go to Manage Site Features and Deactivate and Activate my custom feature manually the MDS turns off.

Any idea how to achieve this?

3 Answers 3

3

We had the same problem. We had a stapling feature that was applying branding to my personal sites. Staplers code ran, but MDS was still active. What we did, was to add a custom control to a personal site master page which deactivated MDS when site was loaded. In this custom control we added if/else check if this code ran once ( by putting value to web.properties) and if it did already, just did not deactivate it again.

We were able to do this, as this was a farm solution. If you are on Office 365 etc, you need to do "Application Stapling"

http://blogs.msdn.com/b/richard_dizeregas_blog/archive/2013/03/04/sharepoint-2013-app-deployment-through-quot-app-stapling-quot.aspx

3
  • Thank you very much. I will try this. I used this in the past (an owned post) but I think is a dirty solution: sharepoint.stackexchange.com/questions/71882/… Commented Mar 21, 2014 at 9:44
  • But how can I activate a master page only for MySites but not for MySiteHost? If I deploy the project of visual studio the receiver activates the new my sites master and substitute my current mysitehost master Commented Mar 21, 2014 at 10:34
  • We have a different master page for maysites vs myhosts. We activate this new master page for mysites with stapler. In a receiver you specify which template you want it to attach to. If i remember that it will use SPSPERS template (ID = 21).
    – dotsa
    Commented Mar 21, 2014 at 16:31
1

PowerShell below will update the current farm “MDSFeature” XML to disable for all newly created site collections and child webs. If you need to support IE8 and older browsers this can be helpful. The feature GUID technically remains active but won’t do anything with missing DLL assembly detail. After desktops upgrade (IE11/Win8) then this change can be reversed with a simple file copy “ORIG” back to “XML.” Hope this helps!

http://www.spjeff.com/2015/02/13/knee-cap-mds-disable-for-new-and-current-sites/

# Disable MDS - run once per farm
# unregister Feature definition from ConfigDB
Uninstall-SPFeature MDSFeature -Force -Confirm:$false

# backup current Feature XML
$path = "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\FEATURES\MDSFeature\feature.xml"
Copy-Item $path "$path-orig"

# modify Feature XML to suppress DLL assembly detail  (still registered, but unable to run)
[xml] $x = Get-Content $path
$x.Feature.RemoveAttribute("ReceiverClass")
$x.Feature.RemoveAttribute("ReceiverAssembly")
$x.Save($path)

# register Feature to ConfigDB
Install-SPFeature MDSFeature
0

I'm not finished testing this, but if you're changing the master page, you can add the following to disable MDS(it will render the page in standard mode nomatter if MDS is activated or not):

<SharePoint:PageRenderMode runat="server" RenderModeType="Standard" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.