Saturday, August 24, 2013

Hide Upload,Multiple, Add Document link from library view for DocSet

The requirement is that to avoid user to create, edit and delete docset, but they can add, upload, edit document inside the Doset. Also, avoid user to add document outside the Docset. 

So for the above requirement, i had created css file and uplaod it to style library and add the path of file path on library view page, where docset available. The css available in my file is as below:-

TD.ms-addnew
{
DISPLAY: none !important
}
#Ribbon\.Documents\.New\.AddDocument-Large
{
display:none;
}
#Ribbon\.ListItem\.New\.NewListItem-Large
{
    display:none;
}
#Ribbon\.Documents\.New\.NewDocument-Large
{
   display:none;
}
#Ribbon\.Documents\.Manage\.EditProperties-Large
{
  display:none;
}
#Ribbon\.Documents\.Manage\.Delete
{
  display:none;
}
#Ribbon\.Documents\.Manage
{
  display:none;
}


and add the below javascript inside the doset page to hide the "View All Properties" and  "Edit All Properties".

<script language="javascript">
_spBodyOnLoadFunctionNames.push("HideShow");
 function HideShow()
{

   var EditProperties = document.getElementById ('EditPropsLink');
if(EditProperties != null)
{
   EditProperties.style.display = "none";
}
var ViewProperties = document.getElementById('ViewPropsLink');
if(ViewProperties != null)
{
 ViewProperties.style.display = "none";
}


}
<script/>
Happy coding..... :-)

No comments:

Post a Comment