I have lists where the items are created from nintex workflows. I need to prevent the users from adding list items manually, as the workflows ensure dependencies.

Revoking the add item permission is not an option, as the workflows need this permission to create the item. (Running with elevated privileges is also no option)

I am aware of three places which need to be handled: 1. The "add new list item" link at the bottom of the list view 2. The custom action "add new [listtype] item" 3. The datasheet view

Current thinking: 1. + 2. : Inject Javascript in to the NewItem.aspx and do a pesimistic permission check using the ClientOM (works). I would prefer to not have the links visible at all, for usability reasons. 3. Only way I see is having a workflow handle this.

Any suggestions / improvements?

2 Answers 2


It is indeed sad that sharepoint does not allow customisation of certain pages and controls out of the box.

Anyways, I'd think your best option is as you suggest to create Javascript which hides the new buttons. I've created a small Script for you which you can inject by using a Content Editor web part on the Allitems.aspx and other ASPX Pages related to this list:

<script language="javascript">   

 function HideNewControls() {
    $('#Ribbon.ListItem.New.NewListItem - Large').hide();
    $('#Ribbon.ListItem.New.NewFolder - Large').hide();
    $('#Ribbon.List.ViewFormat.Datasheet - Large').hide()

Hope this helps.

  • 1
    Just to clarify that you need to add reference to jQuery as this solution uses jQuery. Jul 7, 2011 at 9:16
  • 1
    Great! The dots in the selectors need to be escaped for FireFox though: e.g. $('#Ribbon\\.ListItem\\.New').hide(). Do you know of any way to prevent the user adding a new row in the datasheet by tabbing to the row with the asterix?
    – AyKarsi
    Jul 7, 2011 at 9:51
  • Hi There. The Datasheet view uses a Sealed ActiveX control which you have no control over. I suggest hiding it altogether.
    – Fox
    Jul 7, 2011 at 10:07
  • not really an option to hide the datashee view. Do you know a (server-side) way of seeing if an item was added using the datasheet view?
    – AyKarsi
    Jul 7, 2011 at 10:23
  • There is no way unfortunately. The control adds items the same as you would click New Item..
    – Fox
    Jul 7, 2011 at 15:33

I used the following to hide the last empty row in datasheet view (where new items are added):

    //Add jquery reference
    <script type='text/javascript' src='../../SiteAssets/javascript/jquery-1.10.2.min.js'>
    <script type='text/javascript'>
    //Use _spBodyOnLoadFunctionNames.push to prevent any collisions 
    //with $(document).ready()
    function setDisplay(){
        //. . . 
        //Put any other code needed on page load here 
        //. . .

    function hideLastRow(){
        //If there is more than one datasheet view on the page, 
        //find the id of the table using F12.  Then use that as 
        //the first part of the selector below.  Since each table 
        //row in datasheet view has the "role='row'" attribute we 
        //can use it in the selector.
        var rows = jQuery('table[id*="spgridcontainer"] tr[role=\"row\"]');
        if (rows.length > 0){
            var lastRowIdx = (rows.length)-1;   
            if (lastRowIdx == 1){

    //Bind the hideLastRow function to DOMNodeRemoved so it will 
    //fire again if a row is deleted so it will not reappear if 
    //the table is redrawn.
        var el = e.target;
        //Check if the element removed is one of the datasheetview rows
        if (jQuery(el).is('table[id*="spgridcontainer"] tr[role=\"row\"]')){
            //An assert function was throwing an error so I set it to null 
            //to prevent a pop-up.  After testing there is no need for this 
            //function and it seems to be a bug when thrown in this instance.
            Sys.Debug.assert = function(){};

Note that I used 'jQuery' instead of '$' to prevent problems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.