Saturday, March 14, 2015

How to Disable "Open with Explorer" View in SharePoint 2013

Requirement: Got a requirement to Hide "Open with Explorer" button from a particular library's ribbon menu due to some security reasons.

Solution: Open with Explorer button can be disabled in multiple approaches.

  1. Disable "Client Integration" from Web Application's Authentication Providers.
  2. Remove permissions "Use Remote Interfaces" which also removes "Use Client Integration Features" from permission levels.
  3. Edit the "CustomDefalutTemplates.ascx" file located at: C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\CONTROLTEMPLATES. Find and Replace PermissionString from "UseClientIntegration" to PermissionString="MangeWeb" of nodes with ID "OpenInExplorer"
  4. CSS/JavaScript-jQuery methods to Turn-Off explorer view.
  5. Create a custom action with EMPTY CommandUIDefinition, so that it overrides existing ribbon button.
Lets stick with the last one!

Add Custom Action to Hide Open with Explorer:
While any ribbon button, group, tab can be hidden by overriding the specific custom action using Visual Studio based solution as in How to Hide SharePoint 2010 Ribbon Button, Group, Menu, Tab, Here I'm using PowerShell to add/remove custom action to hide Open with Explorer view in SharePoint 2013.
disable open with explorer in sharepoint 2013
Add custom action to disable Open with Explorer button in SharePoint 2013:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Variables
$SiteUrl="http://operations.crescent.com/Monitoring" 
$ListName = "2015 Documents"

#Get Web and List objects
$web = Get-SPWeb $SiteURL
$list = $web.Lists[$ListName]

#Add an empty Custom Action to Override default custom action
$CustomAction = $list.UserCustomActions.Add()

$CustomAction.Title = "Hide Explorer View"
$CustomAction.Location = "CommandUI.Ribbon"
$CustomAction.commandUIExtension = "
            <CommandUIExtension> 
               <CommandUIDefinitions> 
                     <CommandUIDefinition 
                             Location='Ribbon.Library.Actions.OpenWithExplorer' /> 
                     </CommandUIDefinitions>
              </CommandUIExtension>" 

$CustomAction.Update();

write-host "Custom Action has been Added successfully!" 
and our Output! hide open with explorer button in SharePoint 2013
Delete the custom action from list:
Lets remove the custom action we've created to hide Open with Explorer button.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Variables
$SiteUrl="http://operations.crescent.com/Monitoring" 
$ListName = "2015 Documents"
$CustomActionTitle = "Hide Explorer View"

#Get Web and List objects
$web = Get-SPWeb $SiteURL
$list = $web.Lists[$ListName]

#Get the custom action
$CustomAction = $list.UserCustomActions | where {$_.title -eq $CustomActionTitle} 

#Delete the custom action from list
if ($CustomAction)
{
    $CustomAction.Delete()
}

You can also remove a custom action from SharePoint list via SharePoint designer, as in below screen:
remove custom action from sharepoint designer 2013



You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Check out these SharePoint products:

2 comments :

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...