Home > Blogs > Eric Shupps
​The SharePoint Cowboy


December 05
Hiding Toolbars in the SharePoint 2010 Chart Web Part

SharePoint Server 2010 ships with a nifty Chart web part that displays visual data from a number of sources – SharePoint lists, BDC, Excel services, etc. It's a handy control and one that was sorely missing from the 2007 version. It provides a number of chart options, including pies, lines, bars, cones, scatters, etc. in both 2D and 3D. Neat…but (and there's always a 'but')…it has one very annoying characteristic that drives site administrators crazy. When you drop it onto the page, it displays a toolbar with links for "Data & Appearance" and "Advanced Properties" to everyone with more than basic read permissions, like so:



We certainly don't want everyone to see that – too much temptation to click on those links and blow up our pretty little graphs. Well, ok, should be easy enough to turn that off, right? Wrong.

Somebody, somewhere, forget to include the ubiquitous hide toolbar switch that's on most other out of the box web parts. While trying to figure out a workaround for this nice little undocumented feature, I came across a lot of links to this blog post by Nick Grattan in which he suggests editing the page in SharePoint Designer and changing the web part properties manually in the markup. That's all well and good but anyone who has ever heard me speak at a conference knows that I am not exactly the world's biggest fan of using SPD to edit pages (that may be understating it a bit, sort of like saying the Pope is a little bit Catholic or Texas gets a bit warm in the summertime). So what to do?

Instead of hobbling performance by saving my page markup in the content db via SharePoint Destroyer, I instead opted for a little bit of JavaScript trickery to solve the problem. Turns out the chart web parts renders the toolbar content in a very predictable pattern:



 

The < span > tag in which the toolbar resides is followed by an < img > tag that has a link to a specific page used to render the chart preview image. The < span > also follows an < input > control that is the first child of the parent < div >. That should be easy enough to find in the DOM and just unique enough to insure we don't turn off any other web part toolbars we might want. So, the following script, when added to the page in a hidden Content Editor web part, will hide those pesky toolbars by doing just a little bit of DOM walking:

< script type="text/javascript" >
var arr = document.documentElement.getElementsByTagName("img");
for (var i = 0; i < arr.length; i++)
{
    var imgSrc = arr[i].src;
    if (imgSrc.indexOf("ChartPreviewImage") != -1)
    {
        var parent = arr[i].parentNode;
        parent.childNodes[1].setAttribute("style","display:none");
    }
}
< / script >

If you prefer to use JQuery for messing around with the page DOM that works just fine as well (and probably with half as much code). Unfortunately, it means we have to add the content editor and script to every page our chart web parts are on, but it's better than saving the entire page back to the content DB in Designer.

Problem solved.

 

October 26
SharePoint Global Navigation Sometimes Ignores Target Audience Settings

I recently came across a curious scenario when using target audiences with SharePoint 2010 global navigation. I began with a common enough requirement – create a static menu structure in which certain links would be visible only to members of specific SharePoint security groups (no Active Directory in this particular environment). The basic hierarchy looked something like the following:

Root Node [Members]
-- Publishing Page 1 [Custom SP Group 1]
-- Publishing Page 2 [Custom SP Group 1]
-- Layouts Page [Custom SP Group 2]
-- External Link [Custom SP Group 3]

In reality it was a bit more complex than that but not by much. At first, it all worked as expected. But then I noticed that the Layouts Page and External Link were showing up no matter what group a user was in. That seemed odd but not catastrophic – anonymous users still couldn't see the root node so all it needed was a little tweaking to get the groups right. That's where the fun began. The audience setting for each node mapped to only one SP group and there was no cross-membership in any of the groups. In theory, members of Group 3 shouldn't see anything but the last link; in practice, they were presented with the Layouts Page node and the External Link node but NOT the Publishing Page nodes. No matter what I did, the Layouts and External nodes always showed up.

About this time I realized that the Root node would have to changed as it wouldn't work for users on IOS (iPhone, iPad) – Safari on the touch platform won't allow the drop-down menu to expand like clicking on the arrow with a mouse would. It always navigates the user to the root node link. No problem, I had already dealt with this on the other root nodes, so I simply removed the link from the Root node, left the target audience set to Members, and inserted a child node (thus, when the root node was touched or clicked, it would simply expand the child nodes instead of navigating anywhere). The menu structure then became:

Root Node [Members] (empty link field)
-- Home Page [Members]
-- Publishing Page 1 [Custom SP Group 1]
-- Publishing Page 2 [Custom SP Group 1]
-- Layouts Page [Custom SP Group 2]
-- External Link [Custom SP Group 3]

Oops, now I really had a problem. As soon as I removed the hyperlink value from the root node, the root element, layouts node and external node all became visible to anonymous users! Mucho bad mojo, there – no way would the customer allow non-authenticated users to see a root node that should only be available to authenticated users. I put a random value into the hyperlink field to try and hide to root menu item but nothing worked until I put in a reference to an actual SharePoint object (web, page, list item, etc.) - so long as that object wasn't an application page in the /_layouts directory. Ok, serious head-scratching time. This didn't make any sense at all whatsoever. Why should SharePoint care whether or not the node links to an SP object or www.anyoldwebsite.com?

My immediate suspicion was that somehow the external and layouts links were falling through the security trimming logic in some way. However, Audiences don't work the same way as actual security groups. The only check that's performed on an audience is whether or not the user is a member of the specified group not whether that group actually has permissions on the target object – that's a completely different process. Had it been a security trimming issue, anonymous users wouldn't have been able to see the Layouts Page link as the lockdown feature was enabled on the site. Something else was going on behind the scenes but what could it be.

So, being the curious developer type that I am, I fired up ILSpy, turned on the Developer Dashboard and went to work tracking down this little gem of undocumented functionality. After stumbling along several blind alleys, following umpteen dead-end stub methods (really, do we need a bunch of classes that do nothing but return false every time they're called?), and twisting my brain around convoluted inline nested IF statements, I finally discovered the answer. Turns out that there's a nice little method in the Publishing namespace called CreateObjectFromID that is responsible for taking a reference to a cached node object in a site map data source and returning an object of a specific node type. Unfortunately, there are only three allowable node types – Web, Page or ListItem (with the default in the switch statement being ListItem). This means that a link must point to something that can be converted to one of these three types. Nice – not even a catch to allow for generic or non-SP objects.

As if that little coding blunder wasn't enough, the convoluted logic in the GetNavigationChildren method of PortalSiteMapNode allows a null object (which is the result of not matching one of the three allowable types) to be displayed – the exact opposite of how I would think it should work. This may not be security trimming but it's awfully darn close, at least in spirit – I would have fallen back to hiding anything I didn't know how to deal with (null) instead of allowing it to pass through. So, the net result is this brilliant bit of logic:

  1. If the node includes a link to something that cannot be converted to a Web, Page or ListItem, audience targeting will be ignored.
  2. If the root node does not satisfy #1 then the root and the child nodes will be hidden.
  3. If a child node satisfies #1 it will be displayed only IF the root node also satisfies #1.

The only way to circumvent this functionality is to make sure that all static links in the navigation settings point to valid SharePoint objects that are either a Web (site collection root or subsite), Page (publishing, web part, wiki, etc.) or a list item if you intend to use target audiences to restrict the display of individual nodes.

And there you have it. Another afternoon wasted in the dark back alleys of SharePoint. Aren't you glad I beat my head against the wall so you don't have to?

 

 

October 17
SharePoint Saturday UK 2011 and SharePoint Exchange Forum 2011

SharePoint Conference has come and gone but the conference season isn't over quite yet – there are still plenty of opportunities for great SharePoint content and education available across the pond. First up is SharePoint Saturday UK, being held in Nottingham on November 12th. Nottingham is our new base of operations in the UK and BinaryWave is a Gold sponsor of the event, which is being held right around the corner from our offices at Nottingham Science Park. There will be plenty of good speakers and informative sessions – if you were unable to travel to Anaheim be sure not to miss this one. I've got one session on the developer track covering the Visual Studio 2010 SharePoint tools (with plenty of plugs for the Developer Community Kit – if you want to know how the team built some of the cool integration pieces in CKS:DEV be sure not to miss it):

Customizing the SharePoint Packaging and Deployment Process in Visual Studio 2010

One of the most exciting new features in Visual Studio 2010 is the built-in support for building custom SharePoint 2010 solutions. In this presentation we will explore the various methods available for automated solution packaging and deployment in a development environment. We will also examine multiple ways to package solutions to meet different design and deployment objectives. Finally, we will take a deep dive into the process of extending the out of the box features of Visual Studio to create customized deployment configurations, including SharePoint commands, deployment steps, and Visual Studio Extensibility (VSIX) packages.

The following day (after recovering from the requisite SharePint) I will be jetting off to Stockholm, Sweden for SharePoint Exchange Forum 2011. This annual event is one of my favorites. Stockholm is a beautiful city and Goran Hussman, Office 365 MVP, puts on a great conference. Held at the Clarion Hotel Sodermalm November 14th – 15th, it's two days of intense SharePoint knowledge and networking. Having spent a great deal of time working on the ECM Implementers Course for Microsoft with Rob Bogue, Darrin Bishop, Steve Curran, Ben Robb, and Spence Harbar (who will also be speaking at SEF), I'll be breaking away from my normal Visual Studio and performance optimization topics to deliver a couple of sessions covering Enterprise Content Management in SharePoint 2010:

Taming Information Chaos: Metadata, Taxonomy and Information Architecture Fundamentals for Enterprise Content Management

Implementation of a proper information architecture based on well-defined taxonomies and structured metadata can make information easier to find and dramatically increase productivity; however, getting it right the first time is a challenging task. In this session you will learn the fundamentals of structured information management in SharePoint 2010 and receive guidance from real-world scenarios that can be applied immediately within your organization. Topics include information architecture, taxonomy design, managed metadata, creation and publication of enterprise content types, use of document sets, and much more.

Building Enterprise Records Management Solutions for SharePoint 2010

SharePoint 2010 introduces many new content management features that can be applied to build both document and records management solutions. In this session, we'll examine these features in detail and explore ways to apply them to solve traditional records management problems, such as creating hierarchical file plans, using metadata to drive content routing and making e-Discovery more accessible for records managers and end users.

[Not to worry, I'll still have some cool code demos and useful developer tidbits J]

So put 'em on your calendar and be sure to stop by and say "Howdy"!

 

 

October 06
SharePoint Conference 2011 Wrap Up

Another SharePoint Conference has come and gone. With more than 7,000 attendees, we pushed the facility and surrounding entertainment venues to their limits (let's just say Disney wasn't quite prepared for our kind of crowd). There was a ton of great content, with lots of it being real-world advice from the trenches – and even a few sessions that didn't mention the words "cloud", "on prem" or "365" (which no doubt violated some rule or other).

For those who attended either of my sessions, the decks and related materials can be found here (development) and here (performance). Please note that you'll need the Test or Ultimate versions of Visual Studio 2010 to run the load tests from the performance session (and a very beefy machine if you plan to do host > guest stress testing like I did). If you were at the conference but didn't make it into the sessions, the video is available from your MySPC sessions page (session numbers SPC214 and SPC373). Thanks to everyone who attended and posted all the great messages on Twitter. If you have any questions I was unable to answer on either topic, please add a comment to this post and I'll get back to you as soon as I've recovered a bit from the whole experience.

Next year we head back to Las Vegas to do it all over again (I may need a liver transplant to survive that one). See you there!

 

September 29
Custom Field Elements and the SourceID Attribute

Programmatically creating site columns and content types in SharePoint 2010 is a relatively straightforward process, especially with the new project item framework in Visual Studio 2010 and enhancements like CKS:DEV. Create an element file to define the columns, create another to define the content type and specify which columns to include, deploy it and whistle Dixie 'til the cows come home (or at least until you have to update it, which is an entirely different herd of cows). For a basic text field the declarative markup is pretty simple:

<Field ID="{BF2D02C3-8EF3-44A7-8950-13DE6541AF01}" Name="M_ProjectName" DisplayName="Project Name" Description="Project Name is case sensitive" Group="Custom Site Columns" Type="Text" DisplaceOnUpgrade="TRUE" Required="FALSE" MaxLength="255" />

And including it in the content type is also an easy bank shot (just don't forget to include the brackets in the ID value):

<FieldRef ID="{BF2D02C3-8EF3-44A7-8950-13DE6541AF01}" Name="M_ProjectName" Description="" DisplayName="Project Name" Required="FALSE" howInDisplayForm="TRUE" ShowInEditForm="TRUE" ShowInNewForm="TRUE" />

But wait. There's something missing here that's not completely obvious at first. While (or whilst, depending upon which side of the pond you're from) the site column definition contains a value for the Description attribute, if you deploy the code as is the description text will never show up when the field is rendered on the form. This is due, in whole or in part, to the fact that the Field element is missing the SourceID attribute. The documentation states that this is an optional field and I suppose it is – the field will work without it. But omit it and the description text will not be displayed. Changing the markup to the following will fix the issue:

<Field ID="{BF2D02C3-8EF3-44A7-8950-13DE6541AF01}" Name="M_ProjectName" DisplayName="Project Name" Description="Project Name is case sensitive" Group="Custom Site Columns" Type="Text" DisplaceOnUpgrade="TRUE" Required="FALSE" MaxLength="255" SourceID=" http://schemas.microsoft.com/sharepoint/v3" />

Bingo! The description text shows up right where it's supposed to. This might also affect other functionality that I haven't stumbled across yet. As a general rule, I always include the SourceID attribute when creating site columns declaratively. I have not tried the same thing using a programmatic approach – it may be inferred under that model without the need to specifically declare it. If anyone has tested it that way I'd like to hear about it.

Happy SharePointing!

 

 

September 21
SharePoint Conference 2011

SharePoint Conference 2011 is almost upon us. Anaheim, California is *the* place to be the first week of October for all things SharePoint. There will be more than 200 sessions covering every aspect of the technology stack from top to bottom delivered by top SharePoint experts from around the world.

I'll be presenting two sessions at the conference, one for developers and one for administrators and architects:

SPC214 – Introduction to SharePoint Development
10/3/2011 10:30 AM
You want to start building solutions on SharePoint that require some code but you dont know where to start? Come and learn how to leverage your existing .NET skills to begin creating scalable, secure, and high-performance SharePoint 2010 applications. Take a quick tour through the creation of web parts, discover how to extend SharePoint to remote applications using the client object model, get an overview of user managed solutions using the sandbox and receive a wealth of tips and tricks from real-world scenarios. In addition, you will learn how Visual Studio 2010 makes SharePoint developoment faster, easier, and more efficient than ever before.

SPC373 – Performance Tuning SharePoint 2010
10/5/2011 9:00 AM
There are many facets of SharePoint that can be tuned to dramatically increase the overall performance of your farm. In this session, you will learn real-world performance optimization techniques for SharePoint 2010, including planning and sizing for anticipated usage, handling large numbers of concurrent users, implementing caching and compression, configuring IIS, tuning SQL server, managing large lists and resource throttling, optimizing custom code, reducing page payload and performing load and scalability testing.

Be sure to drop by and say hello – I'll have some groovy giveaways during both sessions. As usual, there will be plenty of extra-curricular activities happening throughout the week. A few are listed below (follow the hashtag #spc11 throughout the week for breaking info):

SharePint
AvePoint RED Party
Idera ESPN Zone
Yammer
Axceler OctoberFiesta

We'll see you in Anaheim!

 


 

August 01
SharePoint Enterprise Content Management Implementers Course

Microsoft has posted the SharePoint Enterprise Content Management Implementers Course on TechNet. The course consists of a set of self-paced videos, student guides and hands-on labs to help you understand, implement and optimize ECM solutions with SharePoint 2010. If you are new to ECM, are considering SharePoint as an ECM solution for your organization, or just need to familiarize yourself with the ECM features in 2010, I highly recommend this as a good starting point.

The course was put together by Rob Bogue and the content authored by folks in the community – Ben Robb, Darrin Bishop, Steve Curran, Rob and, of course, your favorite Cowboy. We put a lot of work into making this a resource that not only gives beginners the knowledge they need to get started but also provides some depth for people already familiar with the topic. For those that have never done this kind of thing before, it's no simple task – authoring training content is much harder than it looks. Unlike presentations created for and delivered by yourself, this type of content is usually delivered by someone else, often as a video. In addition to creating the slide deck, you have to provide engaging visuals, speaker notes, a full-on student manual, step-by-step demos and structured labs. Humor has to be excluded as you never know who might be delivering or viewing the material. And everything you write goes through umpteen stages of review and revisions. It's exhausting.

Tip o' the hat to Rob Bogue for pulling this all together and making it happen. He spent countless hours managing the deliverables, coordinating with Microsoft, wrangling authors to get their stuff done (and redone, and redone again) and still found time to record all the videos himself. And kudos to my fellow authors for burning the late night oil and cranking out the content (and believe me, the vast majority of the content was written well past midnight and into the wee hours).

I hope you enjoy the final product – if you do, please tell Microsoft. Heck, tell 'em even if you don't like it – just download the darn thing so it at least looks like you care, m'kay?

 

July 21
Dallas TechFest 2011

This year the Dallas TechFest has expanded into a two-day event. It's being held at the University of Texas Dallas (which, oddly enough, is actually in Richardson) August 12th and 13th. The fee for the conference is a paltry $100 – a pittance for the amount of content available over both days. Although TechFest isn't a SharePoint-specific conference, there will be plenty of SharePoint content for both developers and IT professionals.

I'll be delivering two sessions at the event:

Building Enterprise Records Management Solutions for SharePoint 2010
Category: Technology and Support
Level: 100
SharePoint 2010 introduces many new content management features that can be applied to build both document and records management solutions. In this session, we'll examine these features in detail and explore ways to apply them to solve traditional records management problems, such as creating hierarchical file plans, using metadata to drive content routing and making e-Discovery more accessible for records managers and end users.

SharePoint 2010 Performance and Capacity Planning
Category: Technology and Support
Level: 100
Deploying a SharePoint environment that can scale from several hundred to tens of thousands of users can be a daunting task which requires careful planning and testing. In this session we will explore the basics of SharePoint capacity planning and discuss best practices for the configuration of databases, service applications, web applications, site collections and lists. We will also review ways to avoid common mistakes and highlight tools and techniques administrators can use to monitor SharePoint performance and identify common causes of performance issues.

 

For more information and registration, visit the following link:

http://dtf-11.eventbrite.com/?ref=ebtn

 

See you there!

 

UPDATE 1: Slide decks are now available in the Presentations library:

Building Enterprise Records Management Solutions for SharePoint 2010

SharePoint 2010 Performance and Capacity Planning 

 

UPDATE 2: I've restructured the list view to make individual presentations easier to find.  All downloads are now grouped first by year and then by event.  If you can't find what you're looking for just add a comment and I'll get it posted.

 

July 14
Selling the Social

Three years ago I posted a screed entitled "Welcome to the Un-Social" on why enterprise customers weren't buying into the whole Social Computing movement. My intent was not to dismiss the potential value of social applications but to challenge proponents to come up with viable business reasons why companies should invest in these new technologies, backed by quantifiable metrics to prove their value. Sadly, over the intervening years, not only have social proponents failed to step up to the plate, but their already tenuous arguments have become so ludicrous that they are beginning to sound a bit unhinged. It would all be quite entertaining if it weren't for the billions of dollars being thrown around trying to make customers swallow a bitter pill they don't want and don't understand.

Over the last few months I've noticed a disturbing trend. Instead of trying to build an actual value proposition for social applications, proponents instead have started attacking the very idea of a value proposition. Sarcastic statements like "What is the ROI of your mother?" or "What is the inherent value of your telephone system?" do not strengthen your argument – they only make you look like an outrider on the lunatic fringe. Folks, let me break this to you in the most direct way I know how: businesses exist to produce a profit for stakeholders. They are not feel-good factories for interpersonal experimentation. Every important decision is based, in one form or another, on its overall impact to the bottom line. Sure, some decisions get made based on emotion (probably way more than should be), but when you're trying to sell a solution you don't tell the customer that their evaluation criteria is wrong. While you may very well be right you'll never win the deal with that approach.

If you want to convince people to see the world your way then you have to at least start by trying to understand where they are coming from. Telling them that business cases don't apply to social solutions is laughable; if you can't make it tangible then don't even bother to make your pitch. You may as well just say "all your competitors are doing it" and try to shame them into buying for all the good that will do you. It amazes me, after all this time, that people are still trying to pretend that the bulk of social applications aren't a complete waste of time. They are and more people realize it today than they did three years ago. The success of Twitter and Facebook hasn't helped; in fact, quite the opposite has occurred. The minute you say "social" to any senior executive in just about any major corporation you're already starting off behind the eight ball – you'd better move fast on your feet because they've already stopped listening to 90% of what you're saying.

Here's an idea – how about we stop trying to pretend we know something they don't and start trying to help them solve problems? Businesses of all types have been churning out profits long before we came along with our newfangled blogs, tweets and friending frenzies. They know how to create shareholder value – do you? And here's another thing to put on your list of failed approaches – the suits don't give a rat's rear end about how millennials would like to see the workplace transformed. If you want a job you're going to do it their way, end of discussion. Remember that whole dotcom boom thing? A whole lot of people tried to come up with all sorts of touchy-feely approaches to business and they failed, precisely because they were trying to do just about everything except make a profit.

Time to stop preaching and start listening. You can start by focusing on areas where social elements have demonstrable value. Take the tagging and rating features in SharePoint 2010. Every organization knows they have a problem finding things that are already there. One of the underlying reasons for this is the disconnect between classification systems and everyday language. Show the customer how unstructured classification (i.e. "folksonomy") can improve findability – it's an easy demo and it resonates. Make a conservative assumption regarding productivity gains, say 2% – 3%, and quantify that impact on the bottom line. Not a bad way to start with the CFO in the room.

Next, stop talking about MySites, perhaps the worst-named feature ever, and start talking about knowledge management. Demonstrate how easy it can be to find a subject matter expert within an organization based on activity feeds, blogs and connections. Ask the customer to provide a list of team members on five recent projects and challenge them to identify, with a high degree of confidence, the SME's in each functional area. Then hit the whiteboard and start counting up the hours that could have been saved, and budget reclaimed, if they knew for sure that the most qualified people were leading each team. You can bet you'll have their attention on that one.

Finally, and perhaps most importantly, ask to see their training budget for the last fiscal year. If you can manage to keep from breaking down into complete hysterics, inquire as to how they intend to keep their workforce up to speed with such a minute portion of revenues dedicated to increasing institutional knowledge. This is your opportunity to start talking about informal learning, the kind that happens when people start virtual conversations on discussion threads, blogs and wikis. Inform them that only 3% of formalized training has any impact at all on the organization and that a large part of the failure is due to lack of application within the workplace. By contrast, informal learning costs less, is put in to practice immediately, has a greater long-term impact and is already happening in every workplace. This type of learning is social by nature – and the biggest dividends come from having access to subject matter experts when you need them (reinforcing my previous point). In other words, if a company is going to spend money on training, why not put it into systems that support and encourage informal learning?

The bottom line is, you'd better start caring about the bottom line or this social stuff is never going to get off first base. Three years on from my first post and we should have seen massive adoption by now; we haven't, and there's a reason for that – because the people who want it to happen and the people who pay for it aren't anywhere close to being on the same page. Face it, none of the people you're trying to sell to follow you on Twitter or "like" you on Facebook. The only people listening to you are fellow inmates in the asylum. You won't get your prospect's attention until you start talking in their language.

It's time to roll up your sleeves, get your calculators out, and start showing companies how they can solve specific business problems in quantitative ways. We've got the tools – they're all there right out of the box. And if they're not quite enough then there are plenty of third parties who make it even better. The problem isn't the platform it's the pitch. The hard truth is that it's going to take a whole lot of spreadsheets to win this battle - it can't be done in 140 characters or less.

June 06
Managing SharePoint Video Chat

During the recent SharePoint Connections Coast to Coast conference in San Antonio, I had a chance to sit down with Jeff Deverter of Rackspace as part of his SharePoint Talks video series. Jeff and I discussed post-deployment management and planning for SharePoint 2010, the challenges of recruiting qualified SharePoint people, the benefits of the SharePoint community, and a few other topics. You can view the video here.

1 - 10Next

 
 
 
 

Copyright © 2011 BinaryWave, Inc. All rights reserved.