How to Disable “Open with Explorer” View

Hi!

In a project we got a requirement to hide the “Open with explorer view” from the ribbon, this can be done by PowerShell by creating a custom action in the library/list

The following code will be used to hide the action from the ribbon:

$sites = get-spwebapplication http://yourwebappurl | Get-spsite -limit ALL
foreach ($site in $sites) {
foreach ($web in $site.AllWebs) {
foreach ($list in $web.Lists) {
$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();
}
}
}

After the code has been executed, the action will disappear from the ribbon.

If you need to recover the action from the ribbon, the following PowerShell can be used for this:

$CustomActionTitle = "Hide Explorer View"
$sites = get-spwebapplication http://yoururlwebapp | Get-spsite -limit ALL
foreach ($site in $sites) {
foreach ($web in $site.AllWebs) {
foreach ($list in $web.Lists) {
$CustomAction = $list.UserCustomActions | where {$_.title -eq $CustomActionTitle}

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

That’s all!

Ref.http://www.sharepointdiary.com/2015/03/how-to-disable-open-with-explorer-view-in-sharepoint-2013.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s