Slinger's Thoughts

February 11, 2008

Hiding “Open with Windows Explorer” from the Actions Menu

Filed under: SharePoint — Tags: , — slingeronline @ 3:26 pm

We had a situation develop here recently in our MOSS site where some of our users were creating folders in document libraries.  Normally this wouldn’t be an issue, but we have decided against using folders in SharePoint for the most part.  One of the reasons for this is that a folder named ENG-MECH-018-25648-IDX doesn’t mean a whole hell of a lot to anybody except the person who created it.  I figured out how to take away the pedestrian ways to create folders in MOSS.  Without removing the ability from myself, since we will use folders in certain areas.  The first and most obvious thing is to remove the “Create Folder” option under the “New” button in a document library.  This is easy enough.  Open your document library, then click on “Settings,” then on “Document Library Settings” from the drop down menu that appears.  This will take you to the page for editing your document library customization.  Click on “Advanced Settings” under the General Settings category.  Near the bottom of this page is a setting category called “Folders.” Set the “Display “New Folder” command on the New menu?” to No.  And that’s that.  Now, a user can’t click on the “New” menu to create a folder.  They can still create documents so this was easy enough.  There is another issue though.  If a user clicks on “Actions,” one of the actions listed will be “Open in Windows Explorer.”  Well this one poses several problems.  The first one, is that if a user is remotely logged in, as many of our users will be, then it just won’t quite work right for them. (It won’t work at all unless they are connected via VPN, which kind of defeats the purpose of having our MOSS site published to the web.)  And I don’t want users complaining that it won’t work.  So I figure, “Out of Sight, Out of Mind.”  Well, the best way to do that would be to remove the option to view in explorer.  I have already removed the “Explorer View” from the views of the document library, but there is still this possibility.  I don’t want to remove the function completely though, since we will use folders at certain times, I just don’t want my users creating folders ad infinitum.  I did a lot of searching, and found many answers on how to add a button to the Actions menu.  I may revisit that later. (I would love to add a “Nuke it from orbit” button.)  I did find one useful answer, although it was a little more extreme than I was hoping.  After doing a little bit a research on the PermissionsString setting, I did come up with an answer that allows Site Owners (presently that’s only me) to add folders using the Actions menu, but no one else has that ability.  This one has to be done on the server.  Log in to your server and navigate to  what MOSS admins affectionately call the “12 Hive.”  Then to Templates\Control Templates.  The file we want is DefaultTemplate.ascx.  Now we don’t need to edit this file, but go ahead an open it, and then make a copy.  I named my copy CustomDefaultTemplates.ascx We are going to edit the copy. First let’s clean up the file size a little bit.  Leave the generic file descriptions at the top of the file.  And you want to leave everything within the <SharePoint:RenderingTemplate ID=ToolBarActionsMenu” runat=”server”> tag and the first </SharePoint:RenderingTemplate> tag after it.  Everything within these tags determines what the actions menu will display depending on whether you are in a list, document library, or other web part.  We don’t technically have to trim this information, but it makes our file size smaller and a little more manageable.  Just to be on the safe side I included the “ToolbarActionsMenuForPictureLibrary” section also.  Now for the fun part.  Look through your file now for ID=”OpenInExplorer” and you will notice that a few lines below this is line that sets the permission for this action. PermissionsString=”UseClientIntegration”  Okay, but that isn’t really the permission that we want.  We could go and delete the whole section, but that would take the ability away from me also.  Instead, I changed that permission from “UseClientIntegration” to “ManageWeb”.  Then save the file, and reset the IIS.  Now, site owners have the ability to “Open with Windows Explorer” but our contributors don’t have that link anymore.  There are other ways to create folders, but I will not detail them here, as the whole idea was to prevent users from creating folders, not tell them alternate ways to do so.  So, no features to create or install, which kind of sucks.  And this applies to the entire site collection, not just one site or two.  But I think it is tolerable since we haven’t completely removed the option, we have just limited it to our Site Owners.  If at any time we need to remove this limitation, all I need to do is move the file to a different location, and reset IIS again.  If needed the code for my CustomDefaultTemplates.ascx is below.  Hope this helps someone else also.  So, now you can see that editing the DefaultTemplates.ascx you can change the permissions on a whole bunch of things.  I don’t recommend getting edit happy with the files though.  And don’t edit the DefaultTemplates.ascx file.  Simply having your custom file in the same directory is enough.  And for the record, I got the answers I needed from here. There are a few other options that he lists on his blog, but this was the answer I needed.  Also, I’m not sure if I needed the entire SharePoint:RenderingTemplate sections, or just the part I needed to change.  I figured it was easier to be safe and include the entire section.

<%@ Control Language=”C#” AutoEventWireup=”false” %><%

@Assembly Name=”Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %><%@Register TagPrefix=”SharePoint” Assembly=”Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” namespace=”Microsoft.SharePoint.WebControls”%><%

@Register TagPrefix=”SPHttpUtility” Assembly=”Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” namespace=”Microsoft.SharePoint.Utilities”%><%@ Register TagPrefix=”wssuc” TagName=”ToolBar” src=”~/_controltemplates/ToolBar.ascx” %><%@ Register TagPrefix=”wssuc” TagName=”ToolBarButton” src=”~/_controltemplates/ToolBarButton.ascx” %>

<SharePoint:RenderingTemplate ID=”ToolbarActionsMenu” runat=”server”>

<Template>

<SharePoint:FeatureMenuTemplate runat=”server”

FeatureScope=”Site”

Location=”Microsoft.SharePoint.StandardMenu”

GroupId=”ActionsMenu”

UseShortId=”true”

>

<SharePoint:MenuItemTemplate

ID=”EditInGridButton”

ImageUrl=”/_layouts/images/menudatasheet.gif”

PermissionsString=”UseRemoteAPIs”

MenuGroupId=”200″

Sequence=”200″

UseShortId=”true”

runat=”server”/>

<SharePoint:MenuItemTemplate

ID=”OpenInExplorer”

Text=”<%$Resources:wss,ToolBarMenuItemOpenInExplorer%>

Description=”<%$Resources:wss,ToolBarMenuItemOpenInExplorerDescription%>

PermissionsString=”ManageWeb”

PermissionContext=”CurrentList”

MenuGroupId=”200″

Sequence=”300″

UseShortId=”true”

runat=”server”/>

<SharePoint:MenuItemTemplate

ID=”ChangeOrder”

Text=”<%$Resources:wss,ToolBarMenuItemChangeOrder%>

Description=”<%$Resources:wss,ToolBarMenuItemChangeOrderDescription%>

MenuGroupId=”200″

Sequence=”400″

UseShortId=”true”

runat=”server”/>

<SharePoint:MenuItemTemplate

ID=”ShowInStdViewButton”

Text=”<%$Resources:wss,ToolBarMenuItemShowInStdView%>

Description=”<%$Resources:wss,ToolBarMenuItemShowInStdViewDescription%>

MenuGroupId=”300″

Sequence=”100″

UseShortId=”true”

runat=”server”/>

<SharePoint:MenuItemTemplate

ID=”NewRowButton”

Text=”<%$Resources:wss,ToolBarMenuItemNewRow%>

Description=”<%$Resources:wss,ToolBarMenuItemNewRowDescription%>

PermissionsString=”AddListItems”

PermissionContext=”CurrentList”

MenuGroupId=”300″

Sequence=”200″

UseShortId=”true”

runat=”server”/>

<SharePoint:MenuItemTemplate

ID=”TaskPaneButton”

Text=”<%$Resources:wss,ToolBarMenuItemTaskPane%>

Description=”<%$Resources:wss,ToolBarMenuItemTaskPaneDescription%>

MenuGroupId=”300″

Sequence=”300″

UseShortId=”true”

runat=”server”/>

<SharePoint:MenuItemTemplate

ID=”TotalsButton”

Text=”<%$Resources:wss,ToolBarMenuItemTotals%>

Description=”<%$Resources:wss,ToolBarMenuItemTotalsDescription%>

MenuGroupId=”300″

Sequence=”400″

UseShortId=”true”

runat=”server”/>

<SharePoint:MenuItemTemplate

ID=”RefreshDataButton”

Text=”<%$Resources:wss,ToolBarMenuItemRefreshData%>

Description=”<%$Resources:wss,ToolBarMenuItemRefreshDataDescription%>

MenuGroupId=”300″

Sequence=”500″

UseShortId=”true”

runat=”server”/>

<SharePoint:MenuItemTemplate

ID=”OfflineButton”

Description=”<%$Resources:wss,ToolBarWorkOfflineOutlookDescription%>

PermissionsString=”UseClientIntegration”

PermissionContext=”CurrentList”

MenuGroupId=”400″

Sequence=”100″

ImageUrl=”/_layouts/images/MenuPIM.gif”

UseShortId=”true”

runat=”server”/>

<SharePoint:MenuItemTemplate

ID=”ExportToSpreadsheet”

Text=”<%$Resources:wss,ToolBarMenuItemExportToSpreadsheet%>

Description=”<%$Resources:wss,ToolBarMenuItemExportToSpreadsheetDescription%>

PermissionsString=”UseClientIntegration”

PermissionContext=”CurrentList”

MenuGroupId=”400″

Sequence=”200″

ImageUrl=”/_layouts/images/MenuSpreadsheet.gif”

UseShortId=”true”

runat=”server”/>

<SharePoint:MenuItemTemplate

ID=”ExportToDatabase”

PermissionsString=”UseClientIntegration”

PermissionContext=”CurrentList”

MenuGroupId=”400″

Sequence=”300″

ImageUrl=”/_layouts/images/MenuDatabase.gif”

UseShortId=”true”

runat=”server”/>

<SharePoint:MenuItemTemplate

ID=”DiagramButton”

Description=”<%$Resources:wss,ToolBarCreateDiagramDescription%>

PermissionsString=”UseClientIntegration”

PermissionContext=”CurrentList”

MenuGroupId=”400″

Sequence=”500″

UseShortId=”true”

runat=”server”/>

<SharePoint:MenuItemTemplate

ID=”ViewRSS”

Text=”<%$Resources:wss,ToolBarMenuItemViewRSSFeed%>

Description=”<%$Resources:wss,ToolBarMenuItemViewRSSFeedDescription%>

MenuGroupId=”500″

Sequence=”400″

ImageUrl=”/_layouts/images/MenuRSS.gif”

UseShortId=”true”

runat=”server”/>

<SharePoint:MenuItemTemplate

ID=”SubscribeButton”

Text=”<%$Resources:wss,ToolBarMenuItemAlertMe%>

Description=”<%$Resources:wss,ToolBarMenuItemAlertMeDescription%>

PermissionsString=”CreateAlerts”

PermissionContext=”CurrentList”

PermissionMode=”Any”

MenuGroupId=”500″

Sequence=”500″

ImageUrl=”/_layouts/images/MenuAlert.gif”

UseShortId=”true”

runat=”server”/>

<SharePoint:MenuItemTemplate

ID=”AddToMyLinksButton”

Text=”<%$Resources:wss,ToolBarMenuItemAddToMyLinks%>

MenuGroupId=”500″

Sequence=”600″

UseShortId=”true”

runat=”server”/>

</SharePoint:FeatureMenuTemplate>

</Template></SharePoint:RenderingTemplate><SharePoint:RenderingTemplate ID=”ToolbarActionsMenuForPictureLibrary” runat=”server”>

<Template>

<SharePoint:FeatureMenuTemplate runat=”server”

FeatureScope=”Site”

Location=”Microsoft.SharePoint.StandardMenu”

GroupId=”ActionsMenu”

UseShortId=”true”

>

<SharePoint:MenuItemTemplate

ID=”EditPictures”

Text=”<%$Resources:wss,ToolBarMenuItemEditPicutres%>

Description=”<%$Resources:wss,ToolBarMenuItemEditPicutresDescription%>

MenuGroupId=”100″

Sequence=”100″

PermissionsString=”EditListItems,UseClientIntegration”

PermissionContext=”CurrentList”

ImageUrl=”/_layouts/images/MenuEditPictures.gif”

UseShortId=”true”

runat=”server”/>

<SharePoint:MenuItemTemplate

ID=”DeletePictures”

Text=”<%$Resources:wss,ToolBarMenuItemDeletePicutres%>

Description=”<%$Resources:wss,ToolBarMenuItemDeletePicutresDescription%>

PermissionsString=”DeleteListItems”

PermissionContext=”CurrentList”

MenuGroupId=”100″

Sequence=”200″

UseShortId=”true”

runat=”server”/>

<SharePoint:MenuItemTemplate

ID=”DownloadPictures”

Text=”<%$Resources:wss,ToolBarMenuItemDownloadPicutres%>

Description=”<%$Resources:wss,ToolBarMenuItemDownloadPicutresDescription%>

PermissionsString=”UseClientIntegration”

PermissionContext=”CurrentList”

MenuGroupId=”100″

Sequence=”300″

ImageUrl=”/_layouts/images/MenuDownload.gif”

UseShortId=”true”

runat=”server”/>

<SharePoint:MenuItemTemplate

ID=”SendPictures”

Text=”<%$Resources:wss,ToolBarMenuItemSendPicutres%>

Description=”<%$Resources:wss,ToolBarMenuItemSendPicutresDescription%>

PermissionsString=”UseClientIntegration”

PermissionContext=”CurrentList”

MenuGroupId=”100″

Sequence=”400″

UseShortId=”true”

runat=”server”/>

<SharePoint:MenuItemTemplate

ID=”ViewSlideShow”

Text=”<%$Resources:wss,ToolBarMenuItemViewSlideShow%>

Description=”<%$Resources:wss,ToolBarMenuItemViewSlideShowDescription%>

MenuGroupId=”200″

Sequence=”100″

ImageUrl=”/_layouts/images/MenuSlideShow.gif”

UseShortId=”true”

runat=”server”/>

<SharePoint:MenuItemTemplate

ID=”OpenInExplorer”

Text=”<%$Resources:wss,ToolBarMenuItemOpenInExplorer%>

Description=”<%$Resources:wss,ToolBarMenuItemOpenInExplorerDescription%>

PermissionsString=”ManageWeb”

PermissionContext=”CurrentList”

MenuGroupId=”200″

Sequence=”300″

UseShortId=”true”

runat=”server”/>

<SharePoint:MenuItemTemplate

ID=”OfflineButton”

Description=”<%$Resources:wss,ToolBarWorkOfflineOutlookDescription%>

PermissionsString=”UseClientIntegration”

PermissionContext=”CurrentList”

MenuGroupId=”400″

Sequence=”100″

ImageUrl=”/_layouts/images/MenuPIM.gif”

UseShortId=”true”

runat=”server”/>

<SharePoint:MenuItemTemplate

ID=”ViewRSS”

Text=”<%$Resources:wss,ToolBarMenuItemViewRSSFeed%>

Description=”<%$Resources:wss,ToolBarMenuItemViewRSSFeedDescription%>

MenuGroupId=”500″

Sequence=”100″

ImageUrl=”/_layouts/images/MenuRSS.gif”

UseShortId=”true”

runat=”server”/>

<SharePoint:MenuItemTemplate

ID=”SubscribeButton”

Text=”<%$Resources:wss,ToolBarMenuItemAlertMe%>

Description=”<%$Resources:wss,ToolBarMenuItemAlertMeDescription%>

PermissionsString=”CreateAlerts”

PermissionContext=”CurrentList”

PermissionMode=”Any”

MenuGroupId=”500″

Sequence=”200″

ImageUrl=”/_layouts/images/MenuAlert.gif”

UseShortId=”true”

runat=”server”/>

</SharePoint:FeatureMenuTemplate>

</Template></SharePoint:RenderingTemplate>

Advertisements

10 Comments »

  1. Hi,

    Thank you for yuor article, it works great in WSS 3.0.

    Comment by Yashneel Pratap — August 19, 2008 @ 6:34 am

  2. Sir,
    Thanks a lot . I wasted hours and broke my head to solve this issue . But your article took a minute to solve my problem….Excellant Sir, Hats off to you, to Microsoft and for your time to share your knowledge to world….I dont know why people are fighting out there in Afghanistan,Iraq,Palestine and Georgia when there are great and beautiful things to think and explore..
    Regards,
    Suresh

    Comment by Suresh Kumar V.C — August 30, 2008 @ 7:59 am

  3. Nice article, but a pain to read.
    Any chance you could format it with paragraphs instead of one huge block of text?

    Comment by SP — December 5, 2008 @ 12:18 pm

  4. Great Article !!!
    Now i wanna to ask… there are some scenarios where user dont want to show documents even to sharepoint administrator. Is it possible to make a folder which can only be seen by its creator ?

    Comment by Sam — December 19, 2008 @ 12:38 am

    • Unfortunately that is the nature of having site admin permissions. Even if there were restrictions placed on a file that wouldn’t let an administrator see the file, the administrator will always be able to take ownership of the file and that defeats the purpose. If a user truly doesn’t want a site admin to see the file, the only things I could recommend would be to keep it in a private library on the user’s mysites page, or not upload it at all.

      Comment by slinger — December 22, 2008 @ 6:41 am

  5. I tried your method but the option is still available. Could it be because we use Active Directory to authenticate?

    Comment by Chau — June 3, 2009 @ 9:51 am

  6. please clarify the steps.. I am stuck in the point, after making a copy of the defaulttemplate.aspx where do we reference in sharepoint to take the template from customized aspx page instead of defaulttemplate.aspx… thanks much..

    Comment by Naresh — July 13, 2009 @ 1:17 pm

    • I second Chau.. normal users still see this “Open with Explorer” option

      Comment by Sanjai — October 7, 2009 @ 10:45 am

  7. Nevermind.. i made changes to the wrong file instead of the Custom one.

    Comment by Sanjai — October 7, 2009 @ 11:07 am

  8. This is neat to know, but you’re missing an important point, as referenced by a blog that links to this page. http://blogs.architectingconnectedsystems.com/blogs/cjg/archive/2009/05/06/Removing-_2200_Open-With-Windows-Explorer_2200_-custom-action.aspx

    Users can still open the document library by using ‘My Network Places’ in Windows Explorer. If you wish to prevent this type of access to a document library, you’ll need to address this as well.

    Comment by Eric — October 21, 2009 @ 2:45 pm


RSS feed for comments on this post. TrackBack URI

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

Create a free website or blog at WordPress.com.

%d bloggers like this: