Search This Blog

Tuesday, 6 August 2013

Add Feature to Disable or Enable New Folder

Hi,
Client want to be able to Enable or Disable a New Folder for a complete site.

You need to create a future for this.

Steps:
Go to :
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES

Create a Folder, i used "DisableNewFolderButton"


Create a file called "Feature.xml" and add the following to it:

**************************************
<?xml version="1.0" encoding="utf-8" ?>

<Feature Id="33057CD9-6D14-45c9-83ED-5E1FE066AC92"

Title="Disable New Folder Button"

Description="Disable New Folder Button"

Version="1.0.0.0"

Scope="Web"

xmlns="http://schemas.microsoft.com/sharepoint/">

<ElementManifests>

 <ElementManifest Location="Manifest.xml"/>

</ElementManifests>

</Feature>
**************************************

Create a "Manifest.xml" and add the following to it:
**************************************
<?xml version="1.0" encoding="utf-8"?>

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

  <CustomAction

      Id="Remove.Document.NewFolderButton"

      Location="CommandUI.Ribbon" RegistrationId="0x0101"

      RegistrationType="ContentType">

    <CommandUIExtension>

      <CommandUIDefinitions>

        <CommandUIDefinition

          Location="Ribbon.Documents.New.NewFolder" />

      </CommandUIDefinitions>

    </CommandUIExtension>

  </CustomAction>

</Elements>
**************************************

Now you need to install the feature:
stsadm -o Installfeature -name DisableNewFolderButton

Now you need to activate it

stsadm -o activatefeature -name DisableNewFolderButton -Url http://dev.Site.domain.com



Now run a IISReset and you will have this feature under your "Manage Site Features"
(Yes it is small but you get the idea)
 So enable it and then your site's Libraries will automatically be set to not show "New Folder"


Note: At one point i got the following error: 



Feature with Id '33057cd9-6d14-45c9-83ed-5e1fe066ac92' is not installed in this farm, and cannot be added to this scope.

Turned out i was trying to run the activate feature before i ran the install  feature command as above.

Ok, now 


Sources:
http://jassimkhan.blogspot.com/2010/10/sharepoint-2010-disable-new-folder.html

http://social.technet.microsoft.com/Forums/sharepoint/en-US/41141fd1-dd55-4791-8270-4343a1a64107/disable-new-folder-button-in-a-document-library


No comments:

Post a Comment