locked
How to Hide ItemToolbar in SharePoint 2007? RRS feed

  • Question

  • Hello all,

    Inshort I need to hide 'Workflows' button in the item toolbar on user role basis.

    I have a custom list with custom .aspx page. Based on the user role I need to hide/show the 'Workflows' button. I could have easily achieved it by giving appropriate read/contribute permission to the users, but I am not allowed to do so as all users need to have Contribute rights to the item.

    Sample scenario: If I have a group A and B, both having Contribute permissions for an item, then I need to make A view the 'Workflows' and hide for the group B.

    So as far as I now, I have gone through 2 different aproaches, but not able to find the way till end. Request for your advise.

    The 2 approaches,

    - to override the .ascx files in the 12 hive folder. But I cannot handle permission through it? or is there a way after all?

    - to edit the permission level 'Contribute' and disable the 'Workflows' view from it. This can be done through '_layouts/editrole.aspx?role=Contribute' , but unluckily I didn't find 'Workflows' option to hide it. Is it true or am I missing something here?

    Regards,

    Shamy


    Shameej

    Monday, May 14, 2012 6:53 AM

Answers

  • Hi shameeji,

    I find you may achieve it by jQuery. So, first, you should judge the people’s group with java script. I find a method on the forum. Then you can hide the button with jQuery.

    <script language="javascript" type="text/javascript" src="http://teams10.sharepoint.hp.com/teams/directo/jquery-1.4.4.js"></script> <script language="javascript" type="text/javascript" src="http://teams10.sharepoint.hp.com/teams/directo/jquery.SPServices-0.6.0.js"></script> <script language="javascript" type="text/javascript"> $(document).ready(function() { $().SPServices({ operation: "GetGroupCollectionFromUser", userLoginName: $().SPServices.SPGetCurrentUser(), async: false, completefunc: function(xData, Status) { if($(xData.responseXML).find("Group[Name='Directo Owners']").length == 1) { //for example if the people is belong to “Directo Owners”, you can hide the button // $("#testworkflowbutton").hide(); } } }); }); </script>

    You can refer to the following link.

    http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/f97b9b37-a667-44e3-abfe-100f07e27154/

    Thanks,

    Jack

    • Marked as answer by Jack-Gao Friday, May 25, 2012 2:02 PM
    Tuesday, May 15, 2012 12:56 PM

All replies

  • Any update on this issue?

    Shameej

    Tuesday, May 15, 2012 11:46 AM
  • Hi shameeji,

    I find you may achieve it by jQuery. So, first, you should judge the people’s group with java script. I find a method on the forum. Then you can hide the button with jQuery.

    <script language="javascript" type="text/javascript" src="http://teams10.sharepoint.hp.com/teams/directo/jquery-1.4.4.js"></script> <script language="javascript" type="text/javascript" src="http://teams10.sharepoint.hp.com/teams/directo/jquery.SPServices-0.6.0.js"></script> <script language="javascript" type="text/javascript"> $(document).ready(function() { $().SPServices({ operation: "GetGroupCollectionFromUser", userLoginName: $().SPServices.SPGetCurrentUser(), async: false, completefunc: function(xData, Status) { if($(xData.responseXML).find("Group[Name='Directo Owners']").length == 1) { //for example if the people is belong to “Directo Owners”, you can hide the button // $("#testworkflowbutton").hide(); } } }); }); </script>

    You can refer to the following link.

    http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/f97b9b37-a667-44e3-abfe-100f07e27154/

    Thanks,

    Jack

    • Marked as answer by Jack-Gao Friday, May 25, 2012 2:02 PM
    Tuesday, May 15, 2012 12:56 PM