Monday, May 19, 2014

How to Hide Site Actions (or any control) Based on Permissions:

Hello Blog Readers!

It has been a while since I have had something interesting to write about, but I wanted to go ahead and post an article on how to hide the site actions button from those pesky users based on permission levels!

**Note hiding and disabling access are two different things.  The users would still be able to access the content if they knew the URL such as… path/_layouts/settings.aspx would still let them hit the site settings even if you hid the site actions control.**

In order to hide the control based upon permissions we will need:
  1.  SharePoint Designer
  2. This Code
    1. <SharePoint:SPSecurityTrimmedControl runat="server" Permissions=”DesiredLevel1,DesiredLevel2,etc”>
      <control to hide>
      </control to hide>
      </
      SharePoint:SPSecurityTrimmedControl>
  3. A control you want to hide
For this example I want to hide the Site Actions from every page in my site, so I will be editing the Master Page.

  1. Open SharePoint Designer
  2. Connect To Your Site
  3. Under Navigation
  4.  Select Master Pages
    1. Select The Desired Master Page
  5. Right Click The Master Page & Select Edit in Advanced Mode
  6. Check Out The Page
After completing steps 1 through 6, we should be ready to wrap the ms-siteactionsmenu span

 <span class="ms-siteactionsmenu" id="siteactiontd">

with our security control in order to hide it based upon permissions.  When we wrap this span in the security trim make sure to find the span's corresponding end tag (</span>).  Depending on how your master page is set up, it could be 30, 50, 100 lines down from your opening span tag.  I typical do a find and search for </span> which typically makes it painless to find.

Now the fun part, lets wrap the span in our security trim control! For the sake of space, I am not including all of my code which would be in between the span.  Instead I am using a very technical note to represent it, aka "Tons of master page code here".

The next step is easy, above your span input

<SharePoint:SPSecurityTrimmedControl runat="server" Permissions=”DesiredLevel1,DesiredLevel2,etc”>
<
span class="ms-siteactionsmenu" id="siteactiontd">
"Tons of master page code here"
</span
</SharePoint:SPSecurityTrimmedControl>

Finally, replace the desired permission level placeholders with the permission levels which are allowed to view and use the hidden control.  The link below has the exhaustive list to choose from.


After you have input the desired permissions, save the updates, check in the page, and publish it if necessary.  I hope this article was able to help and feel free to leave a comment if there are any issues!


Dan

Thursday, March 20, 2014

How To Hide The "Get Organized With This Task List" / "Stay Tuned Updates Coming Soon" From SharePoint 2013 Timeline

Hello!

I just ran across the need to hide the Stay Tuned Updates Coming Soon box from the SharePoint 2013 Time Line.  To be candid I have just really started playing around with 2013 and could not find a way out of the box to easily hide the dialog, so naturally I turned to coding like a good nerd should!  I had a business requirement that wanted the dialog hidden since it really didn't make sense to have that dialog when the list was simply displaying four tasks for the entire year.

To hide this from the page you can either use a content editor and link to the a script file containing the code below or by adding a code snippet web part to the page.  This will hide the dialog from everyone though, so just keep that in mind!

<script>
.ms-psum-countdown-firstRun{
display:none;
}
</script>



Super short post, but hopefully it was helpful for the particular scenario!

Dan

Thursday, March 13, 2014

How to Create Views on Document Set Contents


Hello Cyber People!

I can safely say if you are taking the time to read this post that you have been asked a question which had recently been asked of me “How the heck do we create views on the document set contents?”

Well the answer is a bit obscure and not as user friendly as you would imagine.  In this How To we will actually be editing the document set page, removing the document set contents, and replacing it with a list view web part of the document library.


Assumptions:
You have enabled Document Sets Content Types
You have added a Document Set Content Type or Custom Document Set Content Type to a library
You have added one line item using the Document Set aka you have at least one document set in your library uploaded.
  1. Open a document set you currently have already uploaded in the library
  2. Select Page →Select Edit Page
By editing this page, we will actually be editing the homepage for all of the document sets which are of this content type.
  1. Delete the Document Set Contents web part 
  2. Insert a new Web Part / App Part depending on what version of SharePoint you are using of the library that you are currently working in.  For my example I will be putting my Promotions Library within the document set.
  
My Set Up:
Library: Promotions, Document Set: Promotion, Document Set Contents will be replaced with a list view web part of Promotions.

What I essentially am asking you to do is commit Document Library Inception!  We will be putting this library / list view within the document set.  The document set should automatically send the library / list view the parameter from the query string only showing documents for that particular document set.

After you insert the library view into the document set you should be able to edit the web part and select the view that you would like to display.  For my example, I have grouped my documents by content type.

Cheers!
Dan