none
how to disable the new folder option for contribute and reader access in document library?.

    Dotaz

  • Dear All,

    I have a senario i need to disable the new folder(creating new folder) option in document library.that will be visable only full control or site collection administrator.

    Regards

    Swapna


    SWAPNA

    4. června 2012 2:44

Odpovědi

  • Hey Swapna,

    What type of solution you are expecting, Farm / Sandbox?

    Assuming if its a Sandbox solution you can Work with Replacing UI Ribbon "New Folder" button + Ecma Script to check if the currently logged in user falls under the your required category and disable and enable the Button.

    I've tried to put up a small code snippet for Custom UI Ribbon, which replaces the New Folder Ribbon button with a replaced button but i've not writtent the Ecma Script which checks the User Rights (you can find it here http://webdevshareetc.blogspot.in/2011/10/sharepoint-2010-enabledisable-ribbon.html)

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    	<CustomAction Description="Disable the New Folder Ribbon button" 
    				  Id="90680a52-80dc-430c-8043-fb1a15ce540b"
    				  Location="CommandUI.Ribbon" 
    				  RegistrationType="List"
    				  RegistrationId="101"
    				  Title="ReplaceNewFolderButton">
    		<CommandUIExtension>
    			<CommandUIDefinitions>
    				<CommandUIDefinition Location="Ribbon.Documents.New.NewFolder">
    					<Button Id="Ribbon.Documents.New.NewFolder.ReplacementButton"
    					  Command="ReplacementButtonCommand"
    					  Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png" Image16by16Top="-16" Image16by16Left="-248"
    					  Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png" Image32by32Top="-448" Image32by32Left="-320"
    					  LabelText="Replaced Button"
    					  TemplateAlias="o2" />
    				</CommandUIDefinition>
    			</CommandUIDefinitions>
    			<CommandUIHandlers>
    				<CommandUIHandler
    				  Command="ReplacementButtonCommand"
    				  CommandAction="javascript:#" />
    			</CommandUIHandlers>
    		</CommandUIExtension>
    	</CustomAction>
    
    </Elements>

    Also i've another solution, If you are ready for Farm Solution then you can make use of Delegate Control, which will register a control which in the codebehind checks if the Current logged in user is in the required cateogry and disables/enables the "New Folder" button property on to the Document Library, well with this approach you might need higher rights at somepoint to make the changes on Document Library.


    Thanks
    Akhilesh Nirapure

    7. června 2012 15:39