SharePoint 2010 Consultant’s Handbook Review

I received a copy of Chris McNulty’s SharePoint 2010 Consultant’s Handbook: A Practical Field Guide to Managed Metadata Services at SPTechCon 2011 Boston. Chris was sitting at his booth giving out autographed copies. I walked right up and asked for one. He signed it and we chatted for a few about where I was from and how he had friends or family there. I was grateful for the book but at the time I was focused heavily on the custom development side of SharePoint 2010 and didn’t fully understand just how useful Managed Metadata was. Fast forward 9 months later and now I am focused on SharePoint farm architecture and information architecture. I recalled that I had received this book and since I needed a better understanding of Managed Metadata Services (and since I just went to Chris’s Managed Metadata session at SPTechCon 2012 San Francisco), I figured it was a sign that I should read the book.

The book turned out to be exactly what I needed and a great read. It was short, informative, and had real world examples. From overview, to set up, to real world scenarios, this is the perfect book for getting into Managed Metadata Services in SharePoint 2010. The title tells you all you need to know about what this book is about. During his session at SPTechCon San Francisco, he debuted his new book SharePoint 2010 Consultant’s Handbook: A Practical Field Guide. Based on his first book, I am going to have to buy, read, and review this one too.

Tim Ferro

Developer Tips From the MCTS 70-573 Exam

The MCTS: SharePoint 2010 Application Developer exam (70-573) covers a wide range of skills. The following tips are sure to help with your studying and in your development environment. Please leave comments with your favorite tips and tricks.

SPMonitoredScope
“Monitors performance and resource use for a specified scoped block of code.” – MSDN

This feature is incredibly useful and outputs right to the developer dashboard!
Tobias Zimmergren’s blog post is a great simple explanation. - HERE

SP.UI.Notify.addNotification(strHtml, bSticky)
“Adds a notification to the page. By default, notifications appear for five seconds.” – MSDN

This is the way to add a SharePoint notification to the page. In 2010 it shows in the upper right corner for 5 seconds and then disappears. This is the default action however you can have the message stay until you remove it by changing the bSticky parameter to true. The Method returns the ID of the notification, which you will need to remove it later.

SPListItemVersionCollection.RecycleAll
“Recycles the version collection except for the current version. The RecycleAll method moves the version collection into the recycle bin of the Web site. To delete the version collection permanently, use the DeleteAll method.” – MSDN

Anita Boerboom has a great blog showing you how to use this. – HERE

Tim Ferro

The Mythical Man-Month is the Bible of Software Project Management

“Few books on software project management have been as influential and timeless as The Mythical Man-Month. With a blend of software engineering facts and thought-provoking opinions, Fred Brooks offers insight for anyone managing complex projects. These essays draw from his experience as project manager for the IBM System/360 computer family and then for OS/360, its massive software system. Now, 20 years after the initial publication of his book, Brooks has revisited his original ideas and added new thoughts and advice, both for readers already familiar with his work and for readers discovering it for the first time.” – Amazon description

I could not have described this better myself. This is the bible of software project management; your PMP is incomplete without reading this book. Some of this reads like a textbook but don’t let that keep you from finishing it. There are golden nuggets of information throughout this book and you will use that information your whole career. The graphs important to me involved development time estimation, frequency of bugs found over time, and of course the main graph of time to complete projects based on total developers. If you are involved at any level of the software development process, you must read this book.

Tim Ferro

SharePoint 2010 Pie Chart with Counts

So you want to use an out of the box (OOB) SharePoint pie chart to tell you how many list items have a certain status (or other column choice)? Trying to add that web part to a page and setting its target list as the list you want will not work. Many 3rd party tools exist to deal with this exact limitation of the OOB charting web part. The good news is that in SharePoint 2010 there is an easy way to get this data graphed with the OOB pie chart using a little known trick. For this example I will show you how to set up a Task list where you want to show the Status field count values in a pie chart.

Step 1, create a custom list called StatusLookUp and add an item for each status you want to have. The items in the list will be used as statuses in the “Status” column via a lookup column.

Step 2, create the list you want to use to track your tasks, for this example I am calling it ProjectStatus. If you already have a list this will work as well, you will need to migrate your status column data though. After you have your list setup, create a column called StatusLookup. It will be a Lookup column type and you will use the StatusLookUp list as your input. After creating this column you will need to migrate your current Status column data to this column if you already have a list, if not create a few test items and set their status using this column. This will be a small burden to migrate the statuses of each item but well worth it. I recommend doing it programatically via .Net as a console app or ASPX page. The code for that will simply loop through your list and set the new column data as the current column data with the exception that you will need to format that data to fit into a lookup field type.

This is my basic list with 4 projects that I am tracking and what the status is of each. Note that the StatusLookup field is a lookup of the StatusLookUp list and not the OOB Status field.

Step 3, create a new Lookup column in your StatusLookup list. Call the column Count and reference the column that you just created in your ProjectStatus list. Be sure the column contains “(Count Related)” in the name. Now that you have created your new Status field in your list and migrated the data over, go back to your original StatusLookup list and create a new column that is a lookup of the column that you just created as a lookup to this list. It sounds like a crazy loop but when you do this it returns a count of the number of occurrences instead of the same data.

Step 4, add the chart web part to the page and connect it to your Status Lookup list. Set the Count as your Y axis and the Title as your X axis. Finally, customize your chart to be a pie graph and set your data to display as you wish. Viola! Since this post is about the data and not really about the pie chart I skimmed this part but trust me, you can totally just add the web part and walk through the setup wizard and get the data you need.

Hope this helps, enjoy.

Tim Ferro

SharePoint 2010 Hide Left Navigation

If you Google search the title of this blog post you will find numerous sites that tell you how to easily accomplish this via a simple CSS style change. Use a hidden content editor web part, just like my last post (except you don’t need jQuery), and add the following code:

<style>
BODY #s4-leftpanel { DISPLAY: none }
.s4-ca {MARGIN-LEFT: 0px }
</style>

Done. Simple. However, what if you want the ability to show and hide that on demand? Then you will need this handy JavaScript script code. Just like before, add a content editor web part to the page but this time don’t hide it. Add the following code and you will be able to show and hide the left navigation on demand:

<script language=”javascript”>
function toggle() {
var ele = document.getElementById(“s4-leftpanel”);
var s4 = document.getElementById(“MSO_ContentTable”);
var text = document.getElementById(“displayText”);
if(ele.style.display == “block”) {
ele.style.display = “none”;
s4.style.marginLeft = “0px”;
text.innerHTML = “show”;
}
else {
ele.style.display = “block”;
s4.style.marginLeft = “155px”;
text.innerHTML = “hide”;
}
}
</script>
<a id=”displayText” href=”javascript:toggle();”>Show</a> <== Click Here

Now you have two easy options for temporarily or permanently hiding the left navigation in SharePoint 2010.

There are a number of enhancements to this code that can be made to make it even more useful. The first is the bug that requires 2 clicks to get it working and the second would be setting the user’s selected preference in a cookie so that it always remembers the state that it was in the last time the user logged in. I may work on these in the future but feel free to post that code in the comments section or contact me directly and I will post an update or link to your blog!

Tim Ferro

SharePoint 2010 Access Denied Web Part Error

After upgrading to SharePoint 2010 some web part pages are showing an Error Web Part Error: Access denied. You do not have permission to perform this action or access this resource.“.  For sites without anonymous access, this can be mitigated with audience targeting of the web part. However, if that does not work or you need to have the page be anonymously accessible, but also have web parts on that page that have limited permissions, then you will need a different solution. This is not the perfect solution you are looking for, I am still waiting on Microsoft for that as well, but this is a simple jQuery trick that will hide that awful error and make the page render as you would expect (MOSS 2007 functionality). Just follow the following steps:

  1. Download the latest version of jQuery from their site: http://jquery.com/ and upload it to your server.
  2. At the bottom of the page add a content editor web part and make it hidden.
  3. Add the following code:

<script src=”your-server/jquery-1.6.1.min.js”></script>
<script language=”javascript”>
$(“span:contains(‘Error’)”).hide();
$(“div:contains(‘Access denied’):not(:has(div))”).hide();
</script>

The first line is a reference to the latest version of jQuery on your server. Please remove “your-server” and replace with the correct folder (don’t use absolute references). Make sure this reference works. (It is also possible to link to a Google hosted version of this file however I always use a local copy.) The second line is the beginning tag for writing JavaScript. The 3rd line finds all the “span” elements on the page that contain the word “Error” and then hides them. This might work too well so you need to make sure nothing else on the page is hidden as well that you don’t want hidden. The fourth line finds all the “div” elements that contain “Access denied”, but do not contain any other “div” elements, and hides them. This is crucial as I was unable to hide a “span” and had to use a “div” find and hide. However, since “div” tags are nested throughout this page without the caveat that makes sure the “div” tag doesn’t contain any nested “div” tags, this would have hidden most of the items on the page. The fifth line closes the script tag.

Tim Ferro

SharePoint Podcast: MOSS Gone Wild Review

As part of my August “Little Things” post, I listened to all 5 podcasts from MOSS Gone Wild. They were incredibly insightful and immediately helpful. Through the 5 podcasts, I learned a good number of helpful and important tidbits of information. Whether you administer or develop for SharePoint, these podcasts are for you. Even though they are slightly out of date (the last podcast was released about a year ago), they lay a great foundation for MOSS 2007. You can download the podcasts from either their website or through iTunes. If anyone knows why they stopped making these podcasts or if they are making another one, please let me know. If anyone has any other podcasts that they recommend, please leave a comment with a link.

Tim Ferro