Online Quiz: Is jQuery a valid option for your project?

So, to step back up on my soapbox for a quick moment. The buzz and the noise around jQuery and Client Side development in general is growing and at a fairly rapid pace. This of course is good and bad. It’s good because our applications are becoming more and more user friendly and the visual appeal is increasing exponentially a well.  Plus, as developers, we get to develop some pretty awesome functionality that before we would have had to crack open Visual Studio to get the same results. It’s definitely an exciting time.

However, with this mass adoption comes a lot of headaches. Users are copying and pasting random scripts they find online (and not telling their administrators and developers about it). Developers are writing bad JavaScript and jQuery because they simply don’t know any better. In addition, many less-than-well-rounded developers are making jQuery their “go-to” language because that’s what they know, and hey “it works” so, “why not”?  right?

Unfortunately, with jQuery it also becomes exponentially easier to break a page, cause bad performance, or in some instances bring down your farm. Add to that new technologies like Windows 8 and more and more applications moving to the cloud, client side development is only going to continue to grow. It becomes more critical every day that developers make the right decision as to HOW and WHEN they should be using tools like jQuery. 

To help you guys make this decision for you projects I implemented the little quiz below. If I did my job right and weighted the scores properly it should give you a fairly accurate response and let you know if jQuery is even an option for what you are considering for your environment.  And hey, it was fun to write, so even if the scoring is way off it was a nice break from my normal work routine.  Smile

Go ahead, give it a try. If you have suggestions for more questions or for changing the weighting to be more accurate, I’d love the feedback. As always, thanks for stopping by! 




Do you know JavaScript and CSS? Do you have the ability to debug your scripts and understand what they are doing? Are you NOT just copying and pasting someone else’s script you found floating around out there?

Do you need to manipulate large amounts of data? Do you need to scrape data from tables to build charts/graphs or make web service (client object model) calls to retrieve many rows of data (more than a couple hundred) and iterate through them.

Do you have a plan to maintain and deploy your scripts. Do you know where your scripts are going to live and how you are going to reference them? Do you know how you plan to update the scripts and test these updates?

Do you have to ability to deploy custom solutions (.WSP files). jQuery is a great too when you simply don’t have another choice. In SharePoint 2007 you have to have access to the server to deploy custom code, however in SharePoint 2010 you do get access to Sandbox Solutions which are great option.

Do you have Visual Studio? One of the great things about JavaScript/jQuery is that all you really need is a document library, a CEWP, and notepad.

Does the success of your project rely on quickly modifying and deploying functionality per endless user requests.. I mean.. These guys can't make up their mind.. One day they want blue text, five minutes later they want it red… oh.. And while you're at it can you make that button two pixels larger... really??

Is performance a concern? Is it okay that your page takes 8 seconds to load because the client is doing business calculations that may be done more quickly and efficiently on the server side if this were managed code?

Is this an external facing site where you have no control over what type of computer or browser the user will be using? jQuery is executed on the client computer and if you are using jQuery on an external facing site, you have no control over which browser a user is using or how old and slow it may be. Make sure to tell your external apps in every configuration known to man… twice…

Is visual appeal and usability a major concern? Do the users like animations, or changing colors, or instant feedback while clicking around? Do you get “oohs” and “ahhs” for the simple stylish things that are secretly the easiest part of the application?

Could you develop the same functionality in .NET more quickly and efficiently? Again, just because you know jQuery, doesn’t mean you should use it for everything.

Are you willing to take responsibility for the script you deploy to your site? End users should not be copying and pasting scripts they find online and then whining to their IT department when it doesn’t work right or effectively. If you are going to use jQuery, take responsibility for problems it may cause.

Have you thoroughly tested the scripts on systems similar to the ones your users will be using? Just because it works on your computer, doesn’t mean every user will have a pleasant experience. Take the effort to test and test extensively. Again, for external sites, test, test, test, test, and then test… followed by testing…

Should you be using jQuery?

Answer the questions to calculate your score.

Calculated Score:

SharePoint Saturday Denver–Wrap Up and Slide Decks

Rookie Mistakes–ServerRelativeUrl & SPContext

So, I love how hindsight is 20/20. I love when I carefully (okay sorta carefully) write code, step through it in the debugger, check values, properly catch errors and dispose of objects and you STILL have some stupid error that humbles me a little. Yeah, welcome to my world. In fact I almost didn’t post this blog because I felt pretty foolish, but I figured if I made the mistake maybe someone else did too and I’m all about looking like an idiot if it helps someone else succeed.

This is also the part of my blog where I encourage everyone to start a blog and write about their “duh” moments. You never know who might benefit from a little common sense. I know I could generally use a healthy dose of it.

What was I trying to accomplish?

Just to  give you some backstory and my blog post more verbiage, let me help you understand what I was trying to do. Maybe even a few of you guru’s out there will say “Why the heck didn’t you just do ‘x’??”. 

I had the requirement to allow a user to take a SharePoint site located at http://websiteurl/SiteToMove and move it under some other site in the current site collection’s hierarchy such as: http://websiteurl/ParentSite1/SiteToMove or http://websiteurl/ParentSite1/SubSite2/SiteToMove

I could go into more backstory about why I needed to do this and why other alternatives would not work for us, but it really isn’t germane to the rest of the post. So, let’s assume for the sake of argument there was a good reason, and the other options for achieving the same functionality were not desirable.

How to ‘move’ a SharePoint site?

So, your first question may have been the same as mine, how do you take a SharePoint Site and move it underneath another site? Sounds kind of hairy doesn’t it? I did a few Google.. I mean Bing searches and didn’t find anything very helpful. What are the magic search terms here to get the answer? Well, I went to my second option, which was posting the question on Twitter, and wouldn’t you know it; within 10 minutes I had responses from @Jimmywim, @CraigToThePoint, and of all people @toddklindt (whom I’m convinced is a closet developer) about how this is done.

And when I heard the solution I wanted to facepalm… could it really be that simple? I mean, can anything Todd Klindt say really be trusted? (Yes and Yes by the way). 

Apparently all you have to do “move” a site in this instance (same Site Collection) is update the SPWeb.ServerRelativeURL for the site in questions. That’s it… It sounded so easy I was skeptical, but I tried it out on a small scale and it worked brilliantly! I was a happy camper. Thanks again guys…

How I implemented it

Now I needed to give a user an intuitive way to “move” their site.. So, I created the following process:

  1. User browses to their site
  2. Using a custom web part, user selects which site in the hierarchy of sites is the “parent” site of their site.
  3. The user site’s ServerRelativeUrl is updated with new Path using the path of the “parent” site.

Sounds simple enough? Doesn’t it? And it worked… except that after the web part came back from the PostBack it was throwing an error saying my site didn’t exist, but the site did exist, and it was even updated to the correct path.


Can you guess what I did wrong? Here’s my genius code:

                SPContext.Current.Web.ServerRelativeUrl = newRelativeUrl;

Now do you see it? I should not have modified the Web object in SPContext. The web part needs SPContext on the reload of the page after it comes back from the postback, and since I modified SPContext it was not able to reload the page properly.

When I instantiated my own SPWeb object and updated THAT object’s ServerRelateiveUrl (and properly disposed of the object), everything worked fine and all was right with the world.

Moral of the story

So, moral of the story, and my “duh” moment is be careful updating SPSite and SPWeb objects within SPContext. In fact, you should probably instantiate new objects when updating SPWeb, SPSite, and other collections from SPContext. I know I learned my lesson and will be more careful in the future.

I love making rookie mistakes. On the bright side, at least it wasn’t another jQuery post. Smile

What “The Far Side” can teach us about SharePoint

If any part of you has a sense of humor, January 1995 was a tragic time in your life as it marked the end of one of the greatest comics of all time The Far Side. No other comic has ever been so hilarious in its intelligence and randomness (although Calvin and Hobbes does come close). Gary Larson’s brilliant sense of humor will forever live on in desk calendars, books, and bazillions of internet references. So, what the heck does “The Far Side” have to do with SharePoint you may ask?? Well.. more than you might think actually. Even though the comic ended years before the first version of SharePoint came slithering out the primordial ooze, we can look back on some of them with our SharePoint goggles on and glean some insight into SharePoint and even find some wisdom and guidance.

So, I posit that “The Far Side” can teach as a lot about SharePoint. Inconceivable you say?? Well, let’s see what pearls we can find.

So, your company just told you to “Go do SharePoint.”


How many times have I heard that? Raise your hand if this is your story? I still remember the first day when my boss walked in my office and nonchalantly dropped that bomb in my lap and I had not a clue what to do or how to begin. You are left with a seemingly unpleasant choice: learn this beast called SharePoint or gain the ire of your boss by refusing to do your job. Not a great place to be. Well, for all you frustrated SharePoint people out there, take heart. It may seem like a daunting task with no clear path to victory, but it gets better and there’s lots of help out there. At least sip the kool-aid.

Not to bad, eh? Let’s see what other nuggets of wisdom we can mine from probably the best known Far Side ever.

No matter how smart you think you are, read the directions.


So, you are smart? So what? You’ve been developing software for 15 years you say? big deal! I say. Don’t assume you can do SharePoint development, project management, or administration. Go learn, read the blogs, books, and learn from the experts. Your life will be easier and you won’t look like a fool.

Learn to use the correct SharePoint Terminology


I’ve said this several times before, but SharePoint has its own book of terminology. Remember when a Web Site was the same thing as a Web Application in your conversations as web developer? Well, they are TOTALLY different things in SharePoint, and that’s a simple example. Learn the terminology and understand it. It will allow you to ask the right questions as well as allow the experts to understand you when you speak.

Beware of bears in a cave


Okay, so maybe not bears and maybe not in a cave, but please use caution when you do things in SharePoint. It’s so easy to wander somewhere that you shouldn’t and do some damage if you have the access. Develop on a development server. Test your patches on a dev server. Don’t do a basic install. Stay out of the Content Database. The list goes on of the things that will eat you for lunch if you aren’t careful.

Things aren’t always as they appear in SharePoint


So, this has always been one of my favorite Far Side’s and I had to stretch to make it work for this blog. Let’s see… how can I make it work. Okay.. I got it.. just because someone says they have the answer doesn’t mean they do. Just because an error message is pointing you in one direction doesn’t mean the resolution is in the totally opposite direction. It’s frustrating. You need to learn to keep an open mind when trying to figure stuff out in SharePoint. Yeah.. my reasoning is a little weak here.. but look.. the cows are standing up and talking!!!

Keep an eye on your administrators, developers, and farm


Like it or not, there are a million things that can cause you pain on your SharePoint farm. It may seem like there is some supernatural reason for your problems or outage. Indeed, things like “Unknown Error” “Service Unavailable” or just a random 404 might make you think it’s God playing a cruel joke. However, most problems can be prevented by just keeping an eye on your farm and being diligent. Are your developers disposing of objects? Are they abusing jQuery? Did your admin configure something the wrong way? Is your server running out of resources? This list goes on and on and on as well.

Beware the SharePoint “Expert”


Unfortunately, many of us have fallen prey to that SharePoint “expert.” They may put on a good show and talk the talk, but in the end they really didn’t have the skills to do the job and caused more problems than they fixed.  Use care when getting help for SharePoint. Do some research. Ask some people you trust for their opinion.

You will know the SharePoint experts by their scars


The corollary to the previous comic is finding the SharePoint professional you WANT to do the job. You know these guys know their stuff because they’ll have some scary stories about the problems they encountered. Let’s face it, who would you rather have working for you, the guy who swears he’s an expert and can do any job, or the guy who’s been burned enough to know he doesn’t have all the answers. You learn so much more from your failures than you do your successes.

We were all beginners at one time


So, something I have to continually keep in mind is that there are many things that seem completely like common sense to me and are the most complicated things in the world to people just getting started. I have a session called “Wrapping your Head Around the SharePoint Beast” that I’ve done for three years now. EVERYTHING in that session is common sense to me and anyone who’s been doing SharePoint for a couple of years. I almost scrapped the session entirely when I realized that there are people having SharePoint dropped in their lap every day and having struggles with things we take for granted. So, if you are just getting started, please don’t be discouraged if someone treats you like you should know something, and if you are an “expert” remember that you were in their same shoes not so long ago.

The SharePoint Community


Okay.. okay.. I kid.. I kid… sorta… If you have been in the community for a long time or are brand new, just keep in mind that people are people. We all have our good days and our bad days, and there are a few jerks sprinkled in. Try not to let them bother you and maybe give them a second chance just in case they were up all night trying to fix an issue on their farm the night before.

Just your average SharePoint Junkie


Does this not perfectly sum it up? People outside of the community just don’t get it, and those SharePoint haters sure think we are insane, but we love what we do. I know I’m looking forward to my next SharePoint Saturday and hanging out with all my SharePoint friends. To some people this would be hell, to us there’s nothing we’d rather do.



Yes… yes you may leave now. As always, thanks for reading.

SharePoint Conference 2011 Wrap Up

So, what do you get when 7500+ people converge on Anaheim, California from all over the planet to learn and talk about the best darn collaboration platform in the world while attending a host of vendor parties, a night at DisneyLand, and probably giving the Hilton Bartenders nightmares for the next several weeks???

Why, that would be the SharePoint Conference 2011.

And it was good.

I had the honor of speaking with my good buddy Eric Harlan (@ericharlan). We spoke on Best Practices with jQuery and SharePoint. We spoke about why jQuery is awesome and why jQuery is evil and tried to throw some pearls of wisdom in there along the way. It was a fun session although we had to throw 5 hour energy into the crowd to keep them on their toes.

You can download the slide deck from our session here: SPC314 Best Practices with SharePoint and jQuery

In addition, I posted a site template of all the demos we did here: SPC314.wsp. Just upload the the wsp to your site template gallery and create a site using the template. You’ll be able to execute all the jQuery demos we did during our session. However, if you want to execute the Bing Map demo, you will need to get your own darn Bing Map Key here. If you have any questions about any of the scripts just let me know. I should also mention that in order to ensure you guys had as few problems as possible deploying and using the site template I deactivated as many features as possible including the Custom Actions I used to globally deploy some of the scripts (which is generally the best method for deploying scripts globally) and manually added those references to the scripts themselves. 

Thanks to all those who attended and participated in our session. We had an amazing crowd. You guys rock. 

On another note, Marcy Keller has become the unofficial photographer of the fun times had by all. Below is my jumpshot where I’m about to put Eric Harlan in his place.

Check out the rest of her pictures here:

Next year we’re going to do it all over again in Vegas!!! Better start catching up on sleep now.

jQuery is “Fast Food” Development – SPC314 Session Teaser #SPC11

You ever have an epiphany? Have you ever tried to spell “epiphany” without spell check? So, today I was working on my slide deck for the SharePoint Conference in Anaheim on Best Practices with jQuery and SharePoint and I had a little light bulb moment. jQuery is “Fast Food” development. In those three little words you get an immediate understanding and visual that pretty much hits the nail on the head for what you are getting into with jQuery. 

I then threw together the following two slides to flesh out the idea more. I have no idea if they will end up in the final deck, but I think it’s a great conversation starter.



Want to know more?? Come to my session in October. Smile  Hope to see you there!

A Dummies’ Guide to SharePoint and jQuery–A Real World Example

So, I noticed my good buddy Christina Wheeler (@cwheeler76) wrote a little rant post on Twitter and Facebook today:



And I thought, here’s a great example where you could use jQuery and SharePoint in the wild. With jQuery you could easily hide the “Upload Multiple Files…” link… well.. I assumed you could.. I mean how hard could it be? Keep in mind that ANYTHING you see on the page that is not Flash, Silverlight, or an Active X control can be manipulated with jQuery. There’s probably a couple of other things that can’t be modified, but I don’t know what they are off the top of my head… generally, it can be manipulated.

The Solution

Okay…  let’s break this problem down into it’s pieces and tackle it.  How do we hide the “Upload Multiple Files…” link for a specific document library? First of all let’s go to the upload page and take a look:


We can tell a couple of important things from this page. 

  • The page that needs to be modified is Upload.aspx (that creates some “opportunities”)
  • There is a Query String Parameter that has our List GUID (that might come in handy)

Let’s also look at the page source to see what the DOM looks like. I viewed the DOM and searched for “Upload Multiple Files…” and found our link:

<a id="ctl00_PlaceHolderMain_ctl01_ctl05_UploadMultipleLink" accesskey="U" onclick="javascript:return !LaunchPictureLibraryApp();" href="Upload.aspx?MultipleUpload=1&amp;List=5e57a1e2-ba5c-4c2a-affa-f8c4d41a8580&amp;RootFolder=%2FSiteAssets">Upload Multiple Files...</a>

Creating our script

Believe it or not, we have all the information we need to create our script. So, we are going to create a JavaScript file called “HideUploadLink.js” and upload to our SiteAssets library in SharePoint 2010. Again, refer to my first blog post in this series about adding scripts and jQuery library in SharePoint for any questions on how to do this.

First thing we want to do is figure out how to delete the link. From looking at our DOM we see that the link has an id of “ctl00_PlaceHolderMain_ctl01_ctl05_UploadMultipleLink”. Hmmm… that’s actually not too messy of an ID. Could it be that it’s consistent? As far as I know it is consistent for SharePoint 2010. I’ve not looked at it in other versions, so I don’t know if it’s always going to be that ID. Regardless, that’s what we are using for this demo.  We also know from the second blog post in this series how to get that element to manipulate it.


We also know from doing a quick search on Bing that we can hide an element using the “hide()” method.  So, the script to hide the link is:


That’s pretty cool, but if we put that script on our page it would hide the link for EVERY document library, and we don’t want that. We just want our script to hide the link for one specific library. Hmmm.. so what do we do now? Well… luckily, if you remember, when we go to the Upload.aspx page there is a Query String parameter called “List” that contains the GUID for the document library.  So, all we have to do is check the value of this parameter and compare it to the GUID for the list we want to hide.. and if they match, then we hide it! That sounds easy enough.  So, doing a quick search with Bing I found a function that gets the Query String parameters for me (remember, you don’t have to write everything from scratch. Do a quick search to see if it’s been done before).  When we add in  other logic and create some easy to use functions our script looks like:

    //function to get a Query String Parameter from the URL
    //I did not write this code, I did a search on Bing for
    //"Get Query String using jQuery" and copy and pasted it
    function getParameterByName(name)
      name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
      var regexS = "[\\?&]" + name + "=([^&#]*)";
      var regex = new RegExp(regexS);
      var results = regex.exec(window.location.href);
      if(results == null)
        return "";
        return decodeURIComponent(results[1].replace(/\+/g, " "));

    //function that takes the GUID as a parameter.
    function HideUploadLink(thisListGUID )
        //Get the GUID from the "List" Query String Parameter
        GUIDFromUrl = getParameterByName("List");
        //if the GUID from the Query STring Parameter matches our
        //particular Document Library's GUID, then hide the link
        if (GUIDFromUrl == thisListGUID)
            //hide the link


    // the code that is executed after the page loads. 
    // this is where the action starts
    jQuery(document).ready(function($) {
        //let's call the method that hides the link and pass
        //in the GUID for our Document Library we want to hide
        //the link on


There we go, our script is complete. Now we just need to save our script file to our document library and figure out how to add the script so it can be executed.

Adding our the script

So, now we just need to add our script and we should be good to go. We know from our previous blog posts how to add scripts to a page, but ummm… we don’t have the option to edit this page. What do we do? Unfortunately we are going to have to break one of our rules. Because we can’t edit the Upload.aspx page we need to place a reference to our script in the (da da dum) MasterPage… ugh.. I threw up in the back of my mouth just thinking about it, but that is the solution we are going to take here (I explain in more detail why later on).   Just remember, you should always avoid adding scripts to your MasterPage…. and also remember there is an exception to every rule…

Go ahead and add the references to jQuery and our “HideUploadLink.js” file in your MasterPage right before the closing head tag </head>

<script type="text/javascript" src="/SiteAssets/jquery.min.js"></script>
<script type="text/javascript" src="/SiteAssets/HideUploadLink.js"></script>

Now as part of your MasterPage loading it will hide the “Upload Multiple Files…” link for a specific document library on the Upload.aspx page. Go ahead, give it a try… Not too hairy is it?

So, why use jQuery in this instance?

That’s a good question, and one you should always ask before using jQuery. As awesome as it is, it’s not the answer to every question nor is it the best answer many times.  I know.. I know.. some of you are thinking that I drank the jQuery Kool-Aid and I think jQuery is the answer for EVERYTHING. Well it’s not… okay?  In this instance though I think it may be the best choice and here’s why:

The page in question

So, you might be thinking “Why not just edit the page in something like SharePoint Designer and delete the link off the page or something? Well… even if that was an option I probably would not suggest it and in this instance it’s NOT an option. The page that has the ”Upload Multiple Files…” link is on the Upload.aspx page.. to be more specific it’s on the /_layouts/Upload.aspx">/_layouts/Upload.aspx">http://<site>/_layouts/Upload.aspx page. This is a page that resides on your file system in the _layouts directory. So, if you are using Hosted SharePoint 2010 or Office 365 you CAN’T modify this file at all (as far as I know).  And even if you DO have access to the file system it’s generally bad practice to modify these files and you have no guarantee that some patch won’t overwrite your changes. So, editing the page itself is out of the question.

What other options do you have?

What would Eric Shupps do in this situation? That’s what I ask myself when I’m either writing code or at a bar and generally the answer is either “more code” or “more Corona”. Seriously though, what are the other options here? You have a page in your Layouts directory that you want to modify? I bet Eric would tilt his cowboy hat every so slightly and reach into his back pocket and pull out a custom HTTP handler. Wouldn’t that be slick? With a custom HTTP handler you could redirect the user to your own custom Upload page if they try to go to Upload.aspx. This opens up a world of possibilities for how to handle many situations. However, unless you happen to have a custom HTTP handler written already, it’s not a trivial task to implement one. Also, if you are using Hosted SharePoint 2010 or Office 365 I imagine you can’t deploy a custom HTTP handler as a sandbox solution (I’m sure someone will correct me if I’m wrong). 

It is SharePoint version agnostic

The solution I’m proposing here will work on SharePoint 2007, 2010, Hosted SharePoint 2010, and Office 365… heck, I’m sure it would even work on SharePoint 2003 but does anyone really use that anymore?

It’s quick

Let’s face it. Time is important. Sometimes more important than money. When I saw Christina’s post I had no idea exactly how to do what she asked, I just knew it could be done. From the time I saw her post until the time I emailed her working code took less than half an hour, and I’m pretty sure that involved one bathroom break and a couple of other emails.

What I don’t like about this solution

So, even though this solution works well it’s not perfect. It has a couple of shortcomings that really make it less than ideal. The fact that the script is referenced in the MasterPage is not great because this means that the script gets executed on EVERY page, not just the upload.aspx page. That’s BAD mojo and makes me cringe to think about it. You could somewhat alleviate this problem by checking which page you are on before you execute the script and if it’s not Upload.aspx then don’t  execute the rest of the script, but you have to execute script to check which page you are on. See why I don’t love this? Also, you actually “see” the “Upload Multiple Files…” link for a split second before the jQuery executes to hide the link. You do have other options here if you want to  make the effort (I’m too lazy). You could do something like not hide the link, but instead make it pop up an alert that says “This document library does not allow multiple documents to be uploaded” or something like that. Then the user doesn’t see the link change, just the behavior when they click on it.  Plus, if you make something idiot proof they will make a better idiot. You WILL get some user who calls complaining “There’s no link to upload multiple documents!!!” Ah users… if it wasn’t for users every deployment would be a success.  Smile

Anyway, there you have it. One of the many practical uses of jQuery.  Have a better solution? There’s a comments section for a reason people!! 

Previous Blogs in this series:
A Dummies Guide to SharePoint and jQuery–Getting & Setting SharePoint Form Fields
A Dummies Guide to SharePoint and jQuery–Getting Started

Don’t be “That Company”… Allow your employees to work from home…

I have been very lucky over the span of my career in that every job I’ve had since college has allowed me some flexibility to work from home. Maybe it was just one day a week, maybe a week at home and a week at work, and now I work from home more than 50% of the time. And you know what? It really struck me as totally illogical that more companies don’t allow their employees to do this! 

Yes, I realize not every industry has the luxury of a remote workforce. It would be kind of hard to build a house if you aren’t on site.  This post is specifically geared towards information workers who, thanks to the wonders of the world wide web thingamajiggy, are able to perform their jobs at home as effectively as if they were sitting in their stuffy cubicle.

Sounds like common sense to me?

So… Why should companies consider a remote workforce?


Let’s face it, when an employee works at the office he/she has to get out of bed, take a shower, get dressed, eat breakfast, and head out the door for a commute that averages over 100 hours per year per person. So, let’s say an average case scenario is someone spends 2 hours a day getting ready for work, getting to work and getting home from work. Plus, when they get to work, let’s be honest, they don’t start to work. They chat with people and see how they are doing; they pour a cup of crappy coffee, read their favorite web sites, read emails, chuckle at the latest Dilbert, and THEN (maybe) start to actually work. I’d be surprised if the average 8 hour day at the office entailed more than 3-4 hours of actual work.

So, let’s see how the day looks for a happy employee that works from home. They roll out of bed (more rested because they get to sleep in an extra 30 minutes). They throw on their most comfortable outfit, pour a cup of the best darned home brewed coffee in the world, turn on their computer, read emails, and chuckle at the latest Dilbert all before they would have even left the house! Plus, they aren’t getting interrupted by Suzy who needs to borrow a stapler or that creepy janitor that keeps leaving his phone number on their desk. Add into the fact that the employee isn’t clock watching all day. They don’t have to worry about getting out of there before the traffic gets bad. It’s SOO much easier to finish that last piece of work at 5pm when you are already at home. 

Just imagine if the average 3-4 hours of actual work day were to double? How much more work could get done? Tack on the extra 2 1/2 weeks that are added to the work year by alleviating the commute? That’s money!

Plus, there’s an extra benefit to companies with a remote workforce that many employees don’t think about or want their companies to realize. If you work from home, it’s SOOO much harder to take a sick day. Well, what kind of sick are you? You can still answer emails? It’s okay if you aren’t feeling well this morning, you can still get all your work done for the day by working later at home. Employees loose excuses for not being productive. Yes, it’s a double-edged sword, but I think everyone wins in the end.

Improved Morale

Working from home also does a lot to improve morale. Improved morale leads to further productivity as well as loyalty (which companies must learn to foster better in my opinion). Employees value their time and their comfort. Give them that and they will show their appreciation. Lets face it, people get on each other’s nerves when in close quarters. It’s human nature. Overall relationships can be greatly improved by getting together weekly, bi-weekly, or even monthly instead of every single day of the work week. Quirks are less annoying… voices less grating… and egos less threatened. People like each other a lot more when they see each other a lot less… or maybe that’s me? Maybe people like ME more when they see me less… hmmm… maybe I have to rethink this whole post…

Monetary Benefits

You may or may not be aware, but I live in the hills in Arkansas.. not exactly a high tech mecca.. According to, the per capita income where I live is HALF what it is in Washington DC (where my company is headquartered). Median house prices are 24% of what they are in Washington, DC! 24%!! Do you realize how much it would cost me to move to a location like DC or Boston or (God forbid) San Francisco? How in the world could any company afford me and allow me to maintain any semblance of my current standard of living? 

Think of the money that could be saved if all information workers were allowed to work from home.

  • Reduced building costs – Fewer people in the office means you need a smaller office.
  • Reduced utility costs – Smaller office means less power needed to keep it going.
  • Reduced insurance costs – Smaller office and less people on site means you would pay less insurance.
  • Reduced fuel costs – If you allow your employees to work from home they will save a ton of money on fuel and transit related expenses. It’s almost like an automatic raise! How much will they love you then? Here’s an interesting little web site I ran across that will calculate the “true” cost of your daily commute: It turns out if your daily commute is 20 miles, it is costing you over $7,000 a year! What employee would not be grateful for an automatic $7,000 raise?
  • Reduced salaries – Working from home can be seen as a huge perk and will entice many to work for a reduced salary, also if you allow your employees to work from cheaper parts of the country (Arkansas?) their salaries can be greatly reduced without impact to their cost of living. Did I mention 24% of the median house cost of DC???

The Debbie Downers

For a multitude of reasons a remote workforce makes sense, but it seems it does not happen for just a very few reasons.

Clients want “Face Time”

Yeah, I hear this one all the time and live it at times as well. I understand this mentality and as a client I can understand wanting to have your consultants at arm’s length. This is actually the hardest hurdle to overcome because you have the least control over it. What’s the solution? It really depends on the client. The most effective weapon is to prove yourself to the client and have a rock star “go to” person on site so that the client feels pampered while at the same time having the rest of the tech team knock the project out of the park. I know, easier said than done, but it is doable.

But Employees get too distracted when they work from home

Sure, some employees are not capable of working from home.  They can’t be trusted to do their job. They’ll use the time to go run errands, do some laundry, or catch up on TV.  You know what you do? You don’t allow them to work from home! If their ADD or lack of ethics prevent them from being an effective remote worker, then that is a privilege they don’t get. Yes.. despite everything I’ve said, I do consider it a privilege to work from home and not a “right”. However, setting a “no remote work” rule because of the fear of the few taking advantage of the situation is much akin to cutting off your nose to spite your face.  You are only hurting yourself. Which directly leads to the next reason…

It’s not “Fair” to the employees who can’t work from home

Tough cookie! Life is not fair! Why should the workplace be fair? Organizations should care more about their employees working to their full potential than making the workplace “fair” for everyone. Not everyone can be productive from home (or trusted), not everyone’s job can be done from home (sorry), and sometimes well-meaning clients just have to have that face time. That’s the way it goes. If an employee can’t accept that, then there is a deeper issue going on there. We have WAY too many entitled people in this world… which is another soapbox I will not step up on today....

Let’s Face it..

It’s 2011, and although we were so lied to by both the Jetsons and Marty McFly about the wonders that awaited us, the technology that exists today allows for a far greater level of remote work than is currently being accomplished. The only thing in the way of breaking most companies through to a new level of productivity and employee satisfaction is fear. Fear of what the client will say, fear that the employee will be goofing off, or fear that someone will complain because it’s not fair.

So, what can you do? How do you get past the fear? Here’s an idea. Allow your employee’s to work from home 1 day a week. See how that goes. Make sure it is a Tues, Wed, or Thurs to help reduce the temptation to make it a long weekend. Make sure the employee gives you a very detailed status email first thing in the morning with “What I plan to accomplish today” and a very detailed email at the end of the day with “What I accomplished today”. Make it clear that this is a privilege. If they don’t perform, the privilege is taken away. I think many companies will be surprised at the results. Give it a try, I dare you.

Yes, I realize there’s nothing earth shattering or new here, but maybe there’s some nugget that you didn’t think about before or maybe you are thinking about it in a new way. Regardless, it gave me the opportunity to step on my soapbox once more and you know what.. that can be therapeutic… so at least *I* got something out of this post. Smile

Now back to your regularly scheduled SharePoint blog…

A Dummies Guide to SharePoint and jQuery–Getting & Setting SharePoint Form Fields

Part 2 of a Dummies Guide blog posts deals with setting SharePoint’s form fields using jQuery. If you haven’t read part 1 and are a dummy like me, then go do that first because I’m going to assume you’ve read it and not go back over those pieces:

A Dummies Guide to SharePoint and jQuery–Getting Started


So, I have touched on this topic before in a couple of other blogs, but wanted to make it part of this series so that it was more related. One of the most common things you’ll do with jQuery in SharePoint is use it to set default values for form fields or get the current value of a SharePoint form field. This comes in handy for doing things like cascading drop down lists or  setting fields to a default value that needs to be calculated. You can even do things like look at who the current user is and fill in values specific for that user. The possibilities are really pretty endless and only limited by your ability to write JavaScript and interact with data as you need to.

Elements & Attributes

So, before you can effectively set form values in SharePoint using jQuery it is critical you understand the concept of elements and attributes of an element. An element is defined as a tag name of a DOM node. Ugh… now I have to tell you what the DOM is…  and a node? dang…  rat’s nest anyone?  Okay… let’s try this again….

DOM – Document Object Model

The Document Object Model or DOM is basically the HTML source of your page. I find that is a great reference site for basic information, so you can see how they describe the DOM here.  jQuery searches this DOM to find and manipulate the information that it needs. When using jQuery, the DOM is always changing so if you are using your browser to “view source” you are only seeing the state of the DOM after the page is first loaded before it is manipulated by JavaScript, it does not show the current DOM if any changes have been made. You will utilize one of the multiple JavaScript developer/debugger tools to view the DOM which we’ll hopefully get into in another blog post.   Okay.. fine… if you are using IE Developer Tools (launched by pressing F12) you can view the current state of the DOM by “View->Source->DOM(Page)”


Okay… so do you understand what the DOM is??? 

Nodes & Elements

So… back to to explain a DOM Node:

According to the DOM, everything in an HTML document is a node.

The DOM says:

  • The entire document is a document node
  • Every HTML element is an element node
  • The text in the HTML elements are text nodes
  • Every HTML attribute is an attribute node
  • Comments are comment nodes

If you still have questions about what a node is, read about DOM nodes from the w3schools site using the link above, no reason for me to reinvent the wheel.

So… a NODE is stuff.  Got it?? So, what is an element? Without getting too complicated, an element IS a node within the DOM. So, when I refer to an “input” element… you would search in the DOM for .  A table element would be .

Clear as mud? I’m trying to not get too bogged down in the details here because I want to finish this post before next year. So, if you think I’m not going into enough detail on a subject, please feel free to blog about it and I’ll be happy to link to your blog from here.  Smile

So, we know that our page source is the DOM, and the DOM has element nodes? Right?

ID’s & Attributes

One of the main reasons I use jQuery is that it comes with a lot of functionality to help you search the DOM and it’s elements allowing you to modify these as you need to. The question becomes, how do you FIND the specific element you are looking for??? Right? Before we can set the value of a form field in jQuery (which was the reason for this post if you remember) we have to find it? So.. how do we do this?? Well, the most straight forward way is to use the ID of an element, let’s look at the input field below:

So, there are 3 ways I can think of off the top of my head to search for that element (ugh… I know.. would be nicer if there was only one).  The easiest and most straightforward way is to use the element’s “id” value like thiis:


So, the above line would return my element. ID’s are awesome for this, but your id’s must be unique!! So, how could we use this to get or set a value of a SharePoint form field?  Well.. let’s look at the source code for a field with the display name “My Text Field”:

Wow.. SharePoint really? You generate your id’s like that?  So, using the method I just told you to use, you would have to use the following jQuery to get this element:


Well.. this would work in a pinch, but that id is not consistent and you have no way of knowing what it would be without viewing the page’s source.  There would be no way to create reusable code using that id… so, what do we do?

Let’s look closer at the element for our field… is there any helpful information? There is a section of the element that is ‘title=”My Text Field”. Maybe we can use this?  But what are we looking at? What is “title”?  “title” is an ATTRIBUTE of the element, and the value of that attribute is our SharePoint field’s display name.  With jQuery we have the ability to search for an element with a specific attribute! Rock on jQuery… so that would look like:

$(“input[title=’My Text Field’]”)

So, the above jQuery says “Search all the input elements for one with the attribute of title with a value of “My Text Field”. Viola… we now have a reusable way of finding form fields in SharePoint.

Attributes are awesome, and as you start writing more and more jQuery you can use attributes to store all sorts of cool information.  I like to use them to store item ID’s so I can easily know which list item should be read/updated/or deleted based upon my user’s action. You can even use them to store the ID’s of related list items that you want to do something with. Again, possibilities are only limited to you ability to write jQuery. 

Getting & Setting SharePoint Form Fields

Okay, now that you have the form field’s element, how do you get or set the value of the form field?  This turns out to be an easy exercise. To get the value of the element we would use:

var textValue = $(“input[title=’My Text Field’]”).val();

To set the value we would use:

$(“input[title=’My Text Field’]”).val(textValue);

So, that’s all fine and dandy for setting regular text fields. right? All you have to do is remember to replace “My Text Field” with the display name of your text field for your SharePoint list item.  But what about the other SharePoint fields? They aren’t all going to be this easy?  Well.. yes and no. Some are that easy, and some are a pain in the butt.  Let’s take a look at a few of these.  If you don’t see your exact question answered a good place to always start is to look at your DOM and see how SharePoint is generating the element (that’s how I got started).

Lookup and Choice fields

Lookup and Choices fields are rendered as a select element:

So, the above Choice field has a display name of “My Choice” an it is of type “select”.  Our jQuery for getting and setting this field are:

var mySelectValue = $(“select[title=’My Choice’]”).val();

$(“select[title=’My Choice’]”).val(mySelectValue);

It is important to note that you are setting and getting the option Value, not the displayed text. Also, if you go above 20 items things get really funky if you are using IE.  Luckily I already did a whole blog post on that:

Setting SharePoint Lookup Lists w/ jQuery (+/- 20 items)

Date Fields

Date fields act just like regular text fields, you just need to be sure to set the text to a valid value if you are setting the field:

So, getting and setting that value would be:

var myDateValue = $(“input [title=’My Date Field’]”).val();

$(“input [title=’My Date Field’]”).val(myDateValue);


Okay, let’s look at a checkbox fields source for a checkbox field with the display name “My Check  box”:

Oh crap… where’s our title attribute? How are we going to set or get this field value? Ugh.. my project is due in 10 minutes and you are telling me I can’t use this method with a Checkbox field? WTF?  Dude.. you suck…

First of all.. you have some anger issues… seek help… second of all, let’s dig a little deeper. Let’s look at the ACTIVE DOM… the source above is the DOM from just doing a “view source”.  If we view the active DOM our field looks like:

And look, there’s our title attribute.  So, what happened here?  Let’s go back to the original page source and do a quick search for our element id, and look what we find:

document.getElementById('ctl00_m_g_1e7ef826_b2be_47b2_8c81_60e75c9af0bb_ctl00_ctl04_ctl01_ctl00_ctl00_ctl04_ctl00_ctl00_BooleanField').title='My Check  box';

So, part of generating the page is setting this title attribute manually. Interesting the things you can find out by viewing the page source and dissecting it.  Why was this done? I’m sure there was a good reason.  I just don’t know it.  Okay..enough rambling… sorry… to check if a check box is checked:

if( $("input[title='My Check  box']").is(':checked')) 
   alert("it's checked"); 

If you want to check or uncheck a checkbox programmatically you simply need to set or remove the “checked” attribute of the element. To uncheck a checkbox:

$("input[title='My Check  box']").removeAttr('checked');

To check a checkbox:

$("input[title='My Check  box']").attr('checked','checked'); 


People / Group Fields

Okay… these special fields necessitate a blog post all their own. It’s far too much to get into in the one.  If you really can’t wait until I get around to writing the blog post don’t be scared to view the DOM and wrap your head around these bad boys.

That’s it?

Well, yes.. you were expecting more? The only other thing I can think of to add off the top of my head is that if you are using SharePoint 2007 you may have noticed you do not have the “Edit Page” option for default form pages.  Well.. you can get around this by manually putting these pages into Edit Mode.  You do this by appending “&ToolPaneView=2” to the end of the pages URL.  After you do that you can add all the web parts you want to get your jQuery in the page without having to open it up in SPD.

So, what’s next for this series? I’d love to hear what YOU want? Maybe I’ll do a simple intro for SPServices or the Client Object Model? Regardless, it will hopefully be something you find useful.

As always, I hope you found something helpful, feel free to add to the conversation below and thanks again for stopping by.

Up Next:
A Dummies’ Guide to SharePoint and jQuery–A Real World Example

SharePoint Saturday: The Conference–Slides and Wrap Up

A three day SharePoint Saturday? Yes…a three day SharePoint Saturday. A spawn of speakers, a horde of helpers, A volley of vendors, and an avalanche of attendees converged at a community college in Annandale, VA to create the biggest SharePoint Saturday event to date… and it was good.  I don’t think I’ve ever seen attendees so engaged and excited before! I had packed rooms, awesome interaction, and very few dirty looks… Thanks so much to all of those who chose to attend my sessions with so many other awesome sessions to choose from! I hope you all got something out of what I had to say. 

I’m not even going to bother to mention all the cool people I met, all the friends I got to catch up with, or detail what we did off hours.. that would take WAY too long.  Just know that you all rock and I had an awesome time. I still say the SharePoint Community IS unique… and more awesome than any other. 

So, without further ado, my slide decks from my sessions:

SharePoint & jQuery – What I Wish I Would Have Known When I Started  So, luckily I don’t have to write a wrap up of this session, Bamboo Solutions did a nice job wrapping it up with their post SPSTC: Mark Rackley on 'SharePoint & jQuery - What I Wish I Would Have Known When I Started' Thanks much for attending!

Wrapping Your Head Around the SharePoint Beast I like to call this session “The session that just won’t die!”. This is the first session I ever presented on and I tout it as the session I wish I would have seen when SharePoint was dumped in my lap. I keep thinking I’ll never do it again, but I then remember there are still people in that situation. So, I do believe it’s a needed session and what others find trivial or common sense could be mind blowing to those who really don’t know where to begin. I hope you guys are still finding value in it.

Just Freakin’ Work!! Avoiding Common Hurdles in SharePoint Development So, this session with my most excellent buddy Geoff Varosky (@gvaro) is always a crowd pleaser. Well, actually, it’s 75 minutes of Geoff and I insulting each other while paying vague attention to the slides. Like we always point out though, the real value in this presentation is the slides. I’m just the eye candy and Geoff is… well.. Geoff is a pretty nice guy sometimes.  Smile  We had a packed room with some great interaction from the attendees. Thanks to all those that attended!

So, could this have been the pinnacle of SharePoint Saturday? Did Michael Lotter (@michaellotter), Dux Raymond Sy (@meetdux), Dan Usher (@usher), and the rest of the organizers create the SharePoint Saturday that can’t be outdone? Well, don’t challenge them, because I might have said that about the last SharePoint Saturday DC which hosted 100 speakers and 1000 attendees.  One thing is for sure, these guys can get stuff done and I’m looking forward to attending and speaking again.. I just hope I can add some value here and there.

SharePoint Saturday NYC Wrap Up

So, this previous weekend was my first trip to New York City in over 15 years and I was not disappointed. I was honored to be accepted to speak at SharePoint Saturday NYC. This event was a blast and a well oiled machine executed by Becky Isserman (@mosslover) Greg Hurlman (@ghurlman) and Jason G (not gonna attempt it, sorry) (@PrincetonSUG) along with an incredible supporting cast of heroes making sure the entire event ran smoothly. You guys did an awesome job.




We started off the event with a speaker dinner at St. Andrew’s pub, and like I said in a tweet, if you aren’t a speaker yet, you really need to start.  I mean, just for the free dinners alone. Smile





The only thing more awesome than the organizers and volunteers were the attendees. I don’t think a Hillbilly has ever felt so welcome in the big apple.  I had a amazing group of people attend my session on jQuery and SharePoint. These guys were engaged, asked the right questions, and even taught me a thing or two. Thanks so much to everyone that attended and participated.

As promised, here is a link to my slides on slideshare:


After the event I had the opportunity  to go to Tatiana Russian restaurant in Brighton Beach. This was quite the experience where I got to taste some great food, hear some great music, and even dance my uncoordinated butt off a little. I made some new friends who helped me learn a few words in Russian as well.  A big “Spaciba” to @michaeltnoel, @innagordin, @marina_noel, and @amaxfromriga for making it an unforgettable night. And special thanks to @pswider for arranging to be picked up in a limo for the drive down.  Also in attendance was @ruveng, @buckleyplanet, @robwindsor, @EUSP, @cmcnulty2000, @NedraAllmond, @amilsark (whom I will never forget that his twitter handle stands for “Andrew Milsark”  and NOT “Amil Sark”  Open-mouthed smile) and a few others that you’ll have to forgive me for not knowing their twitter handles.






Thanks for letting me steal some photos from your Facebook albums Mark Miller and Christian Buckley!! Smile

So, can you tell I had a good time? Again, thanks so much to the organizers, attendees, and everyone else who put up with me last weekend. I hope to come back next year and do it all again.

Next up for me is SharePoint Saturday The Conference August 11th – 13th in Washington DC where I’ll be reprising my SharePoint and jQuery session along with my popular “Wrapping Your Head Around The SharePoint Beast” session. I hope to see you there!!

A Dummies Guide to SharePoint and jQuery–Getting Started

I have several conferences coming up where I’ll be talking about jQuery and best practices around deployment, maintenance, and performance tuning in SharePoint and I find that I never have enough time to talk about everything I’d like. So I thought I’d write a few blogs about the subject from a complete beginners standpoint. After all, we were all beginners once and nothing frustrates me more than finding a solution to a problem, but then having no idea how to implement it.

Also, in subsequent blogs I’ll be touching on using SPServices for SharePoint 2007 and the JavaScript Client Object Model in SharePoint 2010. I’ve been avoiding using the JavaScript Client Object Model because SPServices works well in both, but you know what? Someone went to a lot of effort to write the library and I’ve heard it’s much better (actually usable) after the service pack, so this is going to be my excuse to learn it. 

Yes, I realize there are several other blogs out there which cover the same topic (like Adding jQuery to SharePoint by Matthew Hughes), but I do want to give you my spin on things as well as what I have seen as best practices using jQuery in SharePoint seeing as how we use it extensively for some very high profile projects (with great success I might add). So, hopefully that gives my opinions a little credence. In other words, when I tell you to do something it’s because I went through the pains of doing it other ways first. Learn from my pain.

Have you ever noticed that my blogs tend to ramble way off topic and sound very “train of thought?”.  I’ve realized that before, but just had that realization again. So, yeah, sorry about that. If you don’t like it you can get your money back for this post. 

Enough already!  Let’s get you fellow dummies started.

What is jQuery?

jQuery is just a JavaScript library. I highly recommend you be comfortable writing JavaScript before continuing in jQuery unless you really just want to copy and paste other people’s solutions.

You can learn more about jQuery and download the latest library from

So, to use jQuery you will need to write a JavaScript script. This can be as simple as a few lines of text or it can contain thousands of lines depending on what you want to do.  Whatever script you write will load/reference the jQuery library and any third party libraries you intend to utilize. The following heavily commented, but simple script displays a hello world alert after the page has loaded:

// so... first things first the "//" is called a comment (I said this blog post 
// was for dummies) :)  
// A comment is a line of text that is not "executed" and is generally used 
// to either describe what the code is doing, or
// prevent a line of code from being executed.

// The next line of code loads the jQuery library.
// Notice it is loading it from
// I don't recommend referencing these libraries externally.
// I'll explain why later
<script src=""></script>

//indicates that the text between <script> and </script>
// is to be treated as JavaScript
<SCRIPT type=text/javascript>

//jQuery(document).ready is kind of like "main" for you old C people. 
// this is the function that is executed after the page is loaded
// and everything is "ready".  You may also see this as $(document).ready
// regardless, think of this as where your code starts executing. 
// You don't HAVE to use this, but it's a good habit
jQuery(document).ready(function($) {
    //displays the message "Hello World" on the screen. 
    alert("Hello World");


There you go, your first jQuery script. It really doesn’t get much more simple. What we need to do now is get it to work in SharePoint.

What is SharePoint?

It’s a platform. If you don’t know what it is, then why are you reading my blog? I’m not that good of a writer.

Getting jQuery to work in SharePoint

So, again, let’s keep things simple and get the above script working in SharePoint. You have to get your script loaded into a SharePoint page somehow. Like everything else in SharePoint you have several ways of doing this. Some are good, and some are bad. Let’s discuss some of these as well as their pros and cons

The Bad Options

So, What makes these options “bad”? Many reasons actually, if you implement your scripts using the methods below you are making it cumbersome to impossible to maintain, deploy, debug, or re-use scripts. So, yes, I call that bad.

Placing script in Master Pages or directly in aspx page using SPD

I hate, hate, hate (Loathe entirely) this approach. Don’t do it.  Think about it, to modify the script you have to open the page up in SPD or redeploy your MasterPage (because you do deploy your Master Pages as solutions like good boys and girls don’t you?). Well, what if you don’t have SPD access in production for some reason? Then what are you going to do?

Plus you can’t reuse the script anywhere else, and have you ever tried to edit or debug someone else’s script that has been placed directly in a page like this? Talk about a maintenance nightmare.  I don’t care how easy you think it is to develop like this, don’t do it. In fact the ONLY exception I would EVER make to this rule is if you wanted to load a particular JavaScript library that is to be used by every page. I could see sticking the reference to the library in your MasterPage, otherwise, I’ll take a firm stand here and say don’t do this for any other reason.

Placing the script directly into a Content Editor Web Part

From my experience, this seems to be the most common thing people do. They edit the page, put a CEWP on the page, and paste their script into the source for the CEWP.  Although this may work fine for development and playing around, there are some very good reasons not to do this in a production environment:

  • First of all SharePoint 2010 tends to mangle any JavaScript using this method. At the very least it adds a lot of confusing garbage and in some cases it will render your script non-functional.
  • Secondly, the script placed directly in the CEWP is not versioned in anyway, if you a user accidentally deletes the web part, the script is gone.
  • Finally, you can’t reuse the script without having to maintain it in many places.

So, although I SOMETIMES utilize throwing the script into a CEWP for a quick proof of concept, I don’t leave it there and I don’t think you should either.

The Good Options

So, the following options address most of the shortcomings of the previous ones by helping make your scripts more maintainable, reusable, and deployable.  How does it do this? Well, for the following options we will be putting our scripts into their own file and uploading them to a document library. So, before going any further follow these steps:

  1. Create a document library for your scripts (I tend to use the a library called “scripts” but 2010 has a default document library called “SiteAssets” so if you are using 2007 and want to stay consistent with 2010 call your library SiteAssets).  This document library may a “central repository” for many sites or specific for a single site, just be aware of what you are doing and your reasons for doing it.
  2. Upload the jQuery library (and 3rd party libraries) to this document library. Again, I do not agree with referencing your jQuery libraries externally. Yes, you can make the argument that other sites do this and the user is more likely to have it cached, but what does that really gain you but a few milliseconds performance boost the first time you load the page? It is not worth the risks associated with referencing a third party library. What happens if the site where you are referencing your third party library goes down? Or you lose internet connection? or some brilliant developer changes it and breaks something? You are at the mercy of things you cannot control by referencing third party libraries externally. As a good rule of thumb, always download a local copy and put it in your scripts document library.
  3. Ensure your users have read access to this library and upload your scripts to this document library (if they can’t read the script, it can’t be executed).

As I previously stated by putting our scripts into the document library we get a lot of benefits. Including:

  • Versioning – you can turn versioning on in your document libraries and keep older versions of your scripts around in case you need to quickly roll back.
  • Metadata – Don’t upload a script named “jquery.min.1.4.2”, instead upload a script named “jquery.min” and add a field called “version” with a value of 1.4.2.  This allows you to know which version you are using and allows you to upload new versions of jquery (after you have tested of course) without having to go and modify all your scripts to use the new script name. You can also use metadata to give other useful information like which pages use the script.
  • Debugging/Deployment – Debugging and deployment of your scripts becomes as simple as re-uploading a script. This makes quick fixes and modifications extremely easy with little to no impact to users. You don’t like that font color?  BAM… there you go… This is extremely useful for those of us who deal with those “well….. can you make that font smaller and shift everything over two pixels?” people.

At this point I should also mention that some hard core devs will insist that you deploy your scripts to the _LAYOUTS directory using a solution package. This DOES have some benefits including slight decreased load times, but I tend to find that the benefit is minimal and is not enough to consider it a best practice when taking into account all the little extras that using a document library gives you. You can argue that point though (and I know some will). It is absolutely a valid option. I just don’t want to have to deploy a solution every time Nancy changes her mind about a font color.

Okay, so now that we have our scripts in a document library (or deployed to the file system) let’s use them in our page in SharePoint!

Linking to script in a Content Editor Web Part

If you are going to use a Content Editor Web Part to get your script in a page, this is the way to go. It’s simple, fast, and easy. Essentially what you will be doing is telling your Content Editor Web Part to use and load some file instead of putting the script directly in the CEWP. In this case, the file will be your script that we previously uploaded to your document library.

In SharePoint 2007 you go to the “Modify Shared Web Part” menu of your CEWP and put the path to your script in the “Content Link” textbox.


A couple of helpful hints, ALWAYS reference your scripts using the relative path. In my screenshot up there I’m using “../SiteAssets/helloWorld.js” instead of “http://url/SiteAssets/helloWorld.js”.  This makes your life much easier if you are deploying somewhere else.  Also, keep in mind that when you reference the scripts in your script file and you are using a relative path there that the relative path is based upon the page that executes the script, NOT the script library itself. Make sense? In other words, your helloWorld.js script that you have uploaded to your document library should be loading the jQuery library like this:

<script src="../SiteAssets/jquery.min.js"></script>

Instead of:

<script src="jquery.min.js"></script>

This is of course assuming your script is in http://url/SiteAssets and the page referencing your script is at http://url/Pages/page.aspx Make sense now? The path is relative to your page.aspx and not the script itself… great. now I’m confused… just go reread this section until it make sense.   Smile

In SharePoint 2010 the process is basically identical:


So, there you go. That’s how you link your script to your Content Editor Web Part.  In SharePoint 2007 you can simply click the “Apply” button and see your script in action. I’ve noticed in SharePoint 2010 you sometimes have to exit Edit mode in order to see if your script is working or not. 

Using a Custom Control deployed as a solution

According to some aforementioned hardcore devs the way you should go is to create a custom control that references your JavaScript file. Now, I’m not going to go through the process of doing that here, if you REALLY want to know I can do another blog on that some other day, but not today. sorry, what can I say? I’m lazy. 

This process does require more upfront effort to deploy and it needs to be deployed as a solution. In SharePoint 2010 you can do this as a sandboxed solution which makes it pretty painless and a very viable option. However, in SharePoint 2007 you must deploy this to your farm which requires being on the server and is generally more of a pain.  So why would you ever do this?  Well the biggest plus I see is that many people do not like giving users access to the CEWP, they don’t want them writing their own scripts or putting content into the CEWP.  By using a custom control referencing a script you have much more control over those pesky users.. we can’t have them being too productive can we? 

Ta Da

So, yeah.. there you go. To recap, what you need to do to start using jQuery in SharePoint is:

  1. Create a document library for your scripts and jQuery libraries
  2. Write your script, references the appropriate libraries, save it as a file and upload it to your document library
  3. Put a content editor web part on your page and link to the script in your document library
  4. Ta Da…

Again… super basic, intro stuff here. I know I need these types of posts when I really don’t even know how to get started. If you were hoping for more, stay tuned. Maybe I can turn this into a whole cool serious that I can then turn into a book which will in turn be made into a made-for-TV movie… I just hope Ricky Schroder plays the part of me.

Up Next

So… feel like you are ready for Part 2???  You can find it here:

A Dummies Guide to SharePoint and jQuery–Getting & Setting SharePoint Form Fields

What’s YOUR Status in the SharePoint Community?

So, there are a few large SharePoint events coming up including SPSNYC, SPSTC, and the pinnacle of SharePoint conferences The Microsoft SharePoint Conference in Anaheim, CA. As these events approach it becomes more and more important that we label each other effectively. We need to know who is cool and who to avoid. Should I walk up and shake your hand when I see you or quickly cross to the other side of the room?? These are important questions!

Are you a SharePoint Rock Star with legions of adoring fans, your own clothing line, and a library of books written by you? Or are you a SharePoint Stalker? Do you giggle like a school girl when your SharePoint idol mentions you on twitter and toss and turn the night before the next SharePoint Saturday in anticipation of just being in the same room as those you adore?

Well! It’s time to find out!  Using the simple to follow test below we can easily calculate where you are at in this ShareSpectrum and you can fall in line accordingly!! 

So, without further ado…

Calculate your SharePoint Status

Keep track of your numeric score as you answer the following questions:




Are you on Twitter? +1 +0
Do you use some form of your real name as your Twitter handle? +1 -1
Do you have more followers than people you are following? +1 -1
Do you get responses from people when you mention them in Tweets? +1 -2
Do you respond to those who mention you and regularly RT Tweets you find informative and helpful? +1 +10
Do you blog? +1 -2
Do you read the same blogs regularly and anticipate each new post? -5 +0
Could you care less about other people’s blogs? If it’s not yours why bother? +5 +0
If you blog, Do you blog regularly? (more than twice a month) +1 +0
If you blog, Is your blog accurate for the most part? +1 -3
If you blog, do people actually read it? +1 -2
Have you or your blog been the subject of someone else’s blog? +5 +0
Was it because you did something stupid or inaccurate? -5 +0
Do you have any certifications? +0 +0
Do you attend SharePoint Saturdays? +1 +0
If you attend SharePoint Saturdays, Do you speak at them? +2 -2
Do you sit in the back of the room at sessions an “correct” the speaker throughout his presentation? +10 +0
Has anyone ever flirted with you or hit on you at a SharePoint event? +3 +0
Have you ever flirted with or hit on someone at a SharePoint event? -5 +0
Do you put “SharePoint” in front of your name (ie SharePointTom, SharePointDick,SharePointHarry) +5 +0
Do you belong to some group that puts “Share” or “SP” in front of it? (SPJoggers) +5 +0
Do you wish you did? -5 +0
Do you have more SharePoint people as friends in Facebook than people outside of the SharePoint Community? -5 +0
Have you ever been a Key Note speaker at a SharePoint event? +5 +0
Have you ever gone to an event just because of who the Key Note Speaker was? -5 +0
Do you have trouble sleeping the night before conferences because you are so excited about going? -5 +0
Does your wardrobe mainly consist of SharePoint Shirts? -5 +0
Do you have your name or face on a TShirt? +5 +0
Can you name 5 SharePoint vendors off the top of your head that regularly sponsor conferences? +2 +0
Do most people know who you are, but have no clue what you actually do? +5 +0
Do you have a SharePoint Circle on Google+? -5 +0
Are you a pot stirrer, rabble rouser, and enjoy causing controversy on a daily basis? -2 +0
Did you really calculate your score? -5 +5
Do you think this blog post is idiotic, beneath you, and you wish you could have those 3 minutes of your life back? +10 +0


Calculating Your Score

So.. go ahead and add up your numbers, and use the key below to determine where you fall in the spectrum and what it means.

Score Your Label What it Means
< -10 ShareStalker Oh geez.. you are THAT guy. You really need to watch your step before people start taking out restraining orders. It’s okay to like these people and all, but FYI the shrine in your closet is taking it a little too far!
-10 to 10 Just another SharePoint Junkie You can rest easy. You are neither a stalker or an ego maniac that can’t get his/her fat head through the door. You are the perfect mix of technical and social. You know how to have fun without taking yourself too seriously.
10 to 20 SharePoint Rock Star!!! Woah! Step aside… Rock Star coming through! You are the proverbial cream that has floated to the top. You are a beacon and you help others without thinking too highly of yourself. You go the extra mile when possible and we salute you!
>20 SharePoint Egomaniac So… not only have your drank the SharePoint Kool-aid but you’re sippin your own special sauce. Wouldn’t hurt to take a quick look in the mirror and think about those who helped you out along the way. Maybe try giving back and supporting those less god-like than you?



So, yeah.. this blog was all in fun, there’s no scientific results, your score may vary… blah.. blah.. blah…  What’s my point? Well… aside from the enjoyment of being able to write something without having to think too much about it and hopefully making someone smile along the way.. if you REALLY wanted to pull a nugget of wisdom out of it, think about what kind of person that would score very high on this test… then take measures to ensure you aren’t that guy.  Smile There… that should do it.. see.. there’s value in my idiocy if you look really… really… really.. deep.

On the bright side, I PROMISE my next blog post will be about something technical and will actually answer a question or two.  Until then, post your score in the comments below if you dare. Smile  (I scored a 10).

Microsoft Listens - Send an unsung hero to SPC

So, a couple of weeks ago the blogosphere was abuzz with several posts about the SharePoint Community and Microsoft’s role in supporting the community including my post:

Is the SharePoint Community Past Its Prime?

Some people disagreed with me, some agreed with me, and some REALLY agreed with me in private. And do you know what else happened? Chris Johnson (@LoungeFlyZ) Project Manager for SharePoint at Microsoft read the blog… and it got him thinking. He sent me a very cryptic message saying that he appreciated what I had to say and it got them thinking. Today Chris posted the following blog and let me know that my rambling blog post at least partially inspired the competition:

Send an unsung hero to SPC…

First of all, I’m completely honored and humbled that anything I write can spurn people to action and can benefit other people. Secondly, Microsoft rocks and I can’t thank you guys enough for supporting the community and giving some of us this opportunity to go to SPC. I must admit, back in my java days I thought that Microsoft was the evil empire bent on world domination, but after getting more involved with Microsoft’s technologies and seeing all that they do in the form of training, support, and events for the community I STILL believe they are bent on world domination… Smile  But you know what? This kool-aid tastes pretty good. Microsoft invests a LOT of time an money to support ALL of their various communities and I want a company like that to succeed and flourish and I’ll do what I can to support it as well…

So.. click on the link above and help send YOUR unsung hero to the Microsoft SharePoint Conference 2011 in Anaheim, California! I’ll be there and I hope to see you guys there as well!

Is the SharePoint Community Past Its Prime?

So, lots of tweets going on today about an article over at CMS Wire : The SharePoint Community: What it is, Why It's Important and Microsoft's Role. Now, aside from the fact that the CMS web site is a php web site, this article got me thinking…

It’s well written and authoritative, with comments from the experts, and is spot on… but couldn’t it basically have been written verbatim two years ago? And if it could have been written two years ago, how has the SharePoint Community changed in those two years? And are those changes for the best? Like I said.. It got me thinking.

You may be thinking “Why the heck (yes I said ‘heck’) should we give a darn what you think! You redneck!” First of all, no need to get personal.. okay? Second of all I am a Child of the SharePoint Community. I struggled and hated SharePoint for a long time before finding the community around 3 years ago. I started tweeting, blogging, speaking, and drinking that SharePoint Kool-aid with a Community chaser. There is no way I would know half of what I know were it not for these amazing people. In fact, I’ve been espousing the importance of said community since discovering it… and correct me if I’m wrong, but this was also when the community was fairly new? Some of the best friends I’ve ever had have come directly from this Community.. Lifelong friends… almost like family… brothers from another mother… sisters that I feel the need to protect like a big brother… even a couple of crazy aunts and uncles that no one likes to talk about… I am indebted to the community.. and I love you guys…

So, why do you think the community is past its prime?

Okay.. maybe “Past Its Prime” is not entirely what I believe, it just made a good blog title, but I do think the “Good ‘ol Days” may be behind us. The community has been rapidly growing for a few years and I’m afraid it’s reaching a size and maturity level that may NOT be beneficial, and BECAUSE I care about you guys I wanted to say something and hopefully step on as few toes as possible. This blog post is NOT about stirring the pot (although we know I enjoy a good stir), it’s about bringing attention to some red flags I see and trying to figure out how we can fix some things before they get broken. I want the community around for a long time… maybe we can even start some sort of pension plan seeing as how I have no hope of getting Social Security some day.

What are these red flags you speak of?

So, back before I was a SharePoint Junkie, I had attended a .NET event or two, nothing to immersive though, mostly user group meetings. Do you know what I found? It seemed there was always that “one” guy in the crowd that wanted to play “Stump the Chump” and try to look smarter than the speaker. It never failed, and I hated that. These people were trying to help and here’s some moron in the back trying to make sure everyone knows how smart HE is… When I found the SharePoint community there was NONE of that, in fact is was VERY common for some guru to sit in on sessions and root for the speakers and help them along the way. They weren’t trying to make themselves look smart, they were trying to help other people learn. That’s awesome, and one of the things that encouraged me to get started because I knew there would be some support there…. and that’s how it was… for a while at least. I have recently seen a growing trend of that “one” guy popping up in sessions. The one who knows more than the speaker and has to make sure everyone knows he knows more. The guy asking the leading question to try and trick the speaker. The guy who tells the speaker “Well… a better way that *I* use is this”.  ugh… really? Are you so wrapped up in yourself and so threatened that someone is doing the same thing as you that you have to try and belittle them? I’ve had this happen to me a couple of times and have heard it from other speakers as well. I understand, it’s part of the community growing and bringing in more people. You are going to get some riff raff… ahhh.. but it wasn’t like that in the “Good ‘ol days”.


So yeah, as SharePoint matures and the technology matures the egos are starting to grow.. I’m sure I’m not immune to it and please feel free to slap me silly if I ever come off as “better than thou”. It just feels that there is less room and comfort for new people to be able to step in like I was able to. You have to play the political game with some people and you get to the point where you have to think about how everything you do might offend SOME person. At one point, SharePoint Saturdays were a proving ground for new and upcoming speakers, it has morphed into all-star lineups that have rock stars offended if they are not chosen to speak. I totally understand this and would have my ego bruised as well, but those of us who have proven that we can keep a crowd halfway entertained and educated get the honor of speaking at major conferences, it’s okay to let someone else have a turn. right?

I almost didn’t write this blog because it may not be seen as PC… but I think it’s too important to NOT say something. So, if your ego gets bruised and you want be mad at me.. fine.. be that way. I’m sure there’s a .NET user group you can go belittle as well. I’ve seen the community change people and not for the better. Is there any way at all to avoid this? Probably not! It makes sense that in the progression and maturity of a group like this that it would happen. I just wish it didn’t have to. Remember where you came from and who helped you get there. Any success I have in SharePoint is due to the community (and my massively huge brain of course)…

Conference Burn Out

Don’t get me wrong, I love a good conference (Even a THREE DAY SharePoint Saturday?) but at some point burn out is going to set in. Sponsors are going to stop sponsoring as they reach a market saturation and I know many sponsors are trying to sponsor less. Plus there’s a new crop of “For Profit” conferences popping up with people trying to make a buck off the back of the community without being involved in the community. I think it’s all culminating into something that’s not going to end well, but I think we as a community DO have some power here. Have some self control when planning your SharePoint Saturday. If someone close to you plans one first, don’t try to steal their thunder (and sponsorship dollars)… remember, it’s not about you.. it’s about the community? right? Also, community speakers should probably not help promote the fly by night SharePoint conferences just trying to make a quick buck and don’t’ care about the community. A good example of how it SHOULD be done is SPTechCon. BZMedia actually reached out to some of the leaders in the community about how to do their conference and are quite involved in the community in general and very vocal on Twitter. The Best Practices Conference also does an awesome job of embracing the community. Let’s keep the community strong by throwing our support in the right places.


Finally… how do I put this delicately? Microsoft, I love you to death but you at times are causing more problems than you are fixing. I realize Microsoft’s approach for the most part has been to stand back and let the community flourish. Well. it’s flourishing.. and it’s starting to get weeds.. and some of your practices contribute to some of the weeds. A good example of this is the *wincing as I type this* MVP program. Please don’t get me wrong. The MVP program is a phenomenal program and I think it’s really awesome the way Microsoft rewards some members of the community and the MVPs I know are so deserving of the title and I can only hope to be an MVP some day (is there enough brown on my nose yet?). Microsoft has created a problem with its own success here. You created SharePoint, you made this massive beast of a platform that necessitates the creation of this community in order for us to succeed with it, we join the community, we drink the Kool-aid, we get passionate about it, and want to share our passion.. evangelize if you will.. and you are stuck with a HOST of MVPs… and there is no way in the world everyone can be made an MVP… and people start to resent not being MVP.. and resent those they think don’t deserve MVP… and start competing to try to knock someone out so they can be MVP… it can be vicious… and not fun.. and can lead people to wonder why they are doing this if Microsoft won’t give them the time of day… I REALLY think Microsoft needs to step in here and do something before bitterness sets in and people start to resent the MVP program. I’m NOT suggesting you revamp the MVP program,but you GOTTA get more involved in the community, recognize those busting their butt for you, and take on some leadership role in the community. You can lead without controlling. You can reward without taking away from someone else. What about handing out some free SPC passes just for those involved in the community? Maybe doing “community member spotlights” or something to show you are taking notice. As it stands there are those with a secret disdain for the MVP program and those who’ll do anything to get in… I don’t want to see that rift grow… 

Again, I’m not saying Microsoft needs to change the MVP program or that I deserve to be in there… in fact, I can’t imagine this blog post helps my chances, but I do think it’s time for Microsoft to step in and take on a much more visible role in the community, without controlling it. there any hope? Can the utopia we’ve help create endure?

I hope so. I really hope the community has plenty of room to grow… millions of gallons of SharePints to be had… new rock stars to nurture and grow… billions of blogs.. trillions of tweets… plethora of presentations… colossal conferences… and the best darn friends a guy could have…

It’s not all rainbows and butterflies though… cracks are starting to show… let’s not spackle them over and pretend they aren’t there… let’s fix them before they get bad.. let’s take pride in what we’ve helped to create… and remember why we started doing this in the first place.

Thanks very much for all the comments, offline discussions, and polite deriding. Good to know I’m not shouting to the wind. I did want to quickly address a common thread I’ve read/talked about and that is "The things I see are common in a maturing community." I absolutely understand that. I really do. However, I posit that the SharePoint Community IS different and unique and important to the longevity of SharePoint. It is completely possible to be a proficient .NET developer without ever attending one .NET user group or code camp. I personally can write almost anything in .NET and I was never very involved in that community. However, when I did attend the few .NET events I went to, I learned some cool and helpful tips. You can also be a very competent SQL DBA without ever becoming part of the SQL community. It’s NOT a necessity. However… it IS necessary to be part of the SharePoint community to do it right!

How many admins and power users are giving up their weekends for a .NET code camp? How many user tracks are available at SQL events? What’s the mix like at those things? I honestly don’t know, but I’d bet every last dollar I have or will ever have that it is NOTHING compared to SharePoint. Want proof? Take any single .NET guy to a SharePoint event and the first he’ll say is “wow, there’s a lot of women here”. I believe (however ignorantly) that the SharePoint community is by FAR the most diverse community out there with a rich blend of users, administrators, developers, and architects all with their own specialties. Also, as I’ve stated over and over, it’s really not possible to be an expert at all of it. I need the admins. I need the IT Pros. I need the guy down the hall doing the FAST talk, or the branding guru who understands the ins and outs. I need to know who to talk to about DR. The list goes on and on and on. No other technology I’ve experienced has necessitated a community like this. Let’s face it, you can write horrible .NET code and recover from it, you can be a lousy DBA and recover from it. There are a lot of mines in SharePoint that are VERY hard to recover from. Even the most awesome dedicated developer needs an admin. No person is an island in SharePoint. Is that true with the other technologies that have been listed?

This is also not to bash the other communities at all. If you want to be the best .NET developer possible or do whatever you SQL guys do to the best of your potential, then the community is very vital to that, but it’s possible to get along fine in those technologies without it. I DON’T think the same is true for SharePoint. I have conversations every day with people where I used to work that prove that point…

I want the SharePoint community to stay strong and inviting and growing. I don’t want the cracks I see to start causing division and fracture the community. I don’t want to see SharePoint Sundays pop-up because they don’t want to be associated with those Saturday guys. So I blog… I shout to the wind… and have a SharePint… or three…

Thanks again for all you guys do.

Belated SPTechCon Wrap Up & Ramblings – Boston June 2011

So, I had the honor of speaking at the SharePoint Technology Conference (SPTechCon) for the fourth time on June 3rd. I must admit that this conference is just getting bigger and better every time BZMedia puts it together. For those of you not familiar with SPTechCon (, they do the conference twice a year. Once in San Francisco at the beginning of the year and again in Boston in the middle of the year. They get the best speakers (and me) to show up from all over the world and really have some high caliber presentations. Whether you are an IT Pro, Admin, Architect, or Developer you will find some invaluable information. I’d say as far as SharePoint conferences go, SPTechCon is pretty much among the best. Still not sure how I weaseled my way into the speaking ranks, must be my charm and good looks. Either that, or David Rubenstein really needs to do better research Winking smile

Anyway, this year on top of an awesome conference, the location for the Boston conference was upgraded to the Sheraton right next to the Prudential building. Talk about an astounding location for a conference. I can think of few places in the world I’d rather spend a few days than right in the heart of downtown Boston. I just regret that prior commitments kept me away until the final day of the conference and I did not get a chance to really catch up with many of some of the most awesome all around people I know… oh, and Eric Shupps.


So, anyway,I showed up very late Thursday night…well… technically Friday morning at 1am where I found quite the motley crew hanging out in the hotel lounge including my brother from another mother Geoff Varosky (@gvaro), one of my dearest friends Christina Wheeler (@cwheeler76), SharePoint rockstar and all around great guy Andrew Connell (@andrewconnell), my favorite Canadian and perpetual conference attendee Ruven Gotz (@ruveng), my newest SharePoint vegetarian buddy and dog lover Katt Weixel (@katscasa), BZMedia superstars David Rubenstein (@drubinstein) & Katie Serignese (@BZK80) and probably one of the best greetings I’ve ever gotten from Kim Frehe(@chomp1313) that I first met a few weeks previously in St. Louis… and a few other folks that I don’ really know personally or forgot about because they didn’t say too much to me, sooooo… sorry if I forgot you. Smile.  But it was a great, if all too brief evening before speaking at the first session at 8:15 with another SharePoint rock star John Ferringer (@ferringer). 

John and I reprised our session from SPTechCon San Francisco called “SharePoint Mythbusters” where we tackle a few myths from both a developer and administrator standpoint. John and I get great feedback on our session and are actually looking at revamping it as more of a SharePoint “Odd Couple” session where we delve into the complicated but mutually beneficial relationships that SharePoint Administrators and Developers have. This will be a great session for anyone looking to build a cohesive SharePoint team. So, keep an eye out for that session as we test it out at a few SharePoint Saturdays before bringing it fully polished to the next SPTechCon (hopefully).

I ended up bookending the last day at SPTechCon by doing the first session of the day and the last session of the day with my aforementioned brother Geoff Varosky. Geoff and I do a SharePoint development best practices session titled “Just Freakin Work!”… We’ve done this session several times now and have a good rhythm going with it. This fire hose session always gets tremendous feedback from the crowd with comments like “This session is exactly what I came here to see.”.  So, it’s nice to know we can have fun and bring some real value to the conference.  Also look for Geoff and I to do a revamp of this session for the next conference. Oh yeah.. and here’s the slides for those interested:


In addition, I’m also working on putting together an entertaining and insightful session called “You might be a SharePoint Professional if…” where I might happen to rant a little bit about the common obstacles we all face and how to overcome them… 

And wow.. one of the coolest things that happened is meeting the folks at SoftArtisans (@softartisans, @officewriter, @clairedwillett). These guys are doing some cool stuff with document generation very similar to some stuff I’m working on. I’m looking forward to picking their brains a little and sharing some ideas with them. Oh yeah… and did I mention I won an iPad 2? Yeah.. these are my new favorite guys.  Smile


Friday night we made it down to Andrew Connell’s favorite Italian place in the North End called La Famiglia Giogio with Ruven Gotz, Kat Weixel, Jim Bob Howard, and Cory Roth (also Rutherford and Jessica from Vizit who bailed about 5 minutes before we were seated).  We had to wait well over an hour for a table because there was a table reserved for the Prime Minister of Singapore who arrived complete with police escort and secret service protection. I thought for a moment Justin Bieber was showing up or something. Regardless the food was well worth the wait, and pastries at Bova’s afterwards was worth every calorie.  Smile


All in all it was a awesome experience and I can’t wait to see everyone again next time. Keep up the great work David and crew… I’m honored that you allow me to keep coming back.

SharePoint–To the Pain!

Like I’ve said over and over and in many of my sessions, SharePoint is like a big AA Support Group. 

“Hi… My name is Mark, and I use SharePoint”…

“Hi Mark…”

We’ve all had the same pains, frustrations, and struggles.  WHY am I getting this error? WHY isn’t this working the way it’s supposed to? WHY did this work yesterday and not today? WHY can’t I find the answer to my problem? This should be so simple, WHY can’t I get it to work??

This is what makes the SharePoint Community so strong IMO. We’ve been there! We don’t want others to go through that pain! We can support and help each other!  Let’s face it.. there’s not .NET Saturdays all over the country. Is it because more people use SharePoint than .NET? I don’t see people giving up their Saturdays for Java conferences several times a year.

So… anyway… a little firestorm got unintentionally started on Twitter today because of a couple of my tweets. It upset a couple of people who took it out of context and I wanted to set the record straight.

One of the pains many of us have experienced is the sting of inexperienced SharePoint “experts”. These people are giving bad advice in their blogs. These people are in “expert” SharePoint firms charging us an arm and a leg and doing bad work. It’s rampant.. and I’ve experienced it as a full time employee working for a large corporation paying a HUGE amount for SharePoint “experts” who were breaking things and had NO CLUE what they were doing and now as a consultant having to go in and clean up the messes created by other “expert” firms.

Anyway, lately I’ve been trying to think of a slogan for my company (Juniper Strategy) and I thought of a couple of “tongue in cheek” slogans… and me being the sarcastic guy I am started thinking of slogans for all these “SharePoint expert firms” out there… and I had a nice chuckle and thought “hey.. I’ll tweet this”.  So.. I tweeted:

"We make you hate SharePoint just a little less..." #SharePointCompanySlogans

followed by:

"Just when you thought you spent enough money..." #SharePointCompanySlogans

Well.. that started other tweets (which I’ll post below).. which started other tweets.. which started other tweets…  And do you know WHY these tweets were happening? Because it’s a common pain! People “Got it” and wanted to share their pain as well.. and I’m sorry, one of the BEST ways to share pain is through humor.

Anyway, a couple of people, thought that I was bashing SharePoint and Microsoft and were also afraid that other people might take all the tweets out of context and the tweets quickly fizzled out after that. I absolutely do see their point, and if I had thought ahead more I would have used @idubbs suggestion and used the hashtag #ShadySharePointFirms, but hey.. the cat was already out of the bag.

So…I absolutely wanted to set the record straight in this blog post and make sure that everything was put into the correct context with the tweets. If you were offended, I absolutely apologize.

One question I was asked in DM land was

“if I was a company implementing SharePoint and saw community leaders talking like this... I'd be terrified. how DO you find the right company? :-)”

Which I think is a valid point and question. My response is that one of the ways you can KNOW a company is any good is if they have shared your pain... if they can understand your frustrations… if they’ve been there. If you haven’t struggled with SharePoint, fought tooth and nail with her (and lost a few rounds), and come to the brink of frustration, how can you possibly understand where your customers and clients are coming from?

Anyone who knows me knows I speak my mind. You never wonder what I’m thinking. I understand that this can be good and bad. It’s one of the reasons I have a polarizing personality. But, let it never be said that I don’t “get it”. I never claimed to be an expert, I never claimed to be smarter than anyone else… I claim to know the pains first hand, understand them, and want to help.

I have friends ALL over this country (and in many other countries) BECAUSE SharePoint is such a massive beast and can have so many pain points! I wouldn’t change it for the world!! Why else would half these people sit down and have a beer with me? Because of my charm and good looks? Well sure… some of them.. but mostly because we share a common pain and passion…  Let’s not forget the things that make this community unique and strong… I do see things actually changing somewhat.. and not always for the better… Let’s keep it strong… keep it passionate… and keep it enjoyable…

As the wise @SharePointeer said… “C'mon - hug it out.”

I’ll sum this blog post up with my final tweet on the matter…

“SharePoint = awesome... okay? Got it? and you KNOW who knows it well by those who've shared your pain.”

So… without further ado.. the company slogans that caused the raucous… I hope you now have the correct context… some are serious.. some are funny… all should make you think because there are pearls of wisdom in each one… I was NOT able to find all the slogans because Twitter’s search does not go back that far. Feel free to post your own..

And finally.. If you can’t have a sense of humor about some of this stuff, you need to find a new technology…

(names have been removed to protect the guilty)…

So easy even a hillbilly can do it #SharePointCompanySlogans

#SharePointCompanySlogans SharePoint made simple

Governance, you don't need no sticking governance. #SharePointCompanySlogans

"You need SharePoint Designer to do that" #SharePointCompanySlogans

"SharePoint is like a box of chocolates ..." #SharePointCompanySlogans

"In Soviet Russia, SharePoint installs you" #SharePointCompanySlogans

"You can be our next feature receiver"#SharePointCompanySlogans

"You don't find SharePoint, SharePoint finds you!" #SharePointCompanySlogans

"Lets Collaborate" #SharePointCompanySlogans ;-)

"SharePoint Foundation can do that for free! We just need to do a little customization in SharePoint Designer." #SharePointCompanySlogans

SharePoint is Mjölnir #SharePointCompanySlogans

that's a known issue #SharePointCompanySlogans

"Padding our bills with extra 0's since SharePoint 2003..." #SharePointCompanySlogans

You don't need to talk to our stakeholders, we (the IT department) know what they want... #SharePointCompanySlogans

Yeah, um, sure, we can do that. I think... #SharePointCompanySlogans

SharePoint - Yeah, I can build that. #SharePointCompanySlogans

"We know what end users want" #SharePointCompanySlogans

"We put the CREEP in scope creep..." #SharePointCompanySlogans

"You start coding. I'll go find out what they want."#sharepointcompanyslogans

I haven't failed, I've found 10,000 ways that don't work. #SharePointCompanySlogans

"Why buy one farm when you can buy two at twice the cost?" #SharePointCompanySlogans

"Bread & Crumbs - We navigate" #SharePointCompanySlogans

Unnecessary's how we roll! #SharePointCompanySlogans sooooo true :)

"My cousin's dog tells me that their hairdresser says that SharePoint does that!" #SharePointCompanySlogans

"If you build it, they will #$*@ it up...."#SharePointCompanySlogans

"It Depends...." #SharePointCompanySlogans

"Stop changing your requirements, and we'll stop raising our rates... " #SharePointCompanySlogans

"SharePoint.. we don't know it, but our rates just doubled... " #SharePointCompanySlogans

"Breaking your support agreement with Microsoft since 2003" #SharePointCompanySlogans

"We have more than 10 years experience with SharePoint 2010" #SharePointCompanySlogans

“Why be frustrated with SharePoint when you can be frustrated with us??" #SharePointCompanySlogans

"Sorry... you can't do that out of the box" #SharePointCompanySlogans

"SharePoint... Make it idiot-proof, and they'll find a bigger idiot." #SharePointCompanySlogans

“We are MOSS 2010 experts!” #SharePointCompanySlogans

"We take the kick in the nads so you don't have to" #SharePointCompanySlogans

"Sorry... that's SharePoint" #SharePointCompanySlogans

"How much money do you have?" #SharePointCompanySlogans

"An error has occurred" #SharePointCompanySlogans

"Pay more... get less" #SharePointCompanySlogans

"We're not incompetent, we just don't know what we're doing." #SharePointCompanySlogans

"Finding stuff on codeplex and charging you for it..." #SharePointCompanySlogans

"We are Share-point experts" #SharePointCompanySlogans

The Real Value of Microsoft Certification in SharePoint???

How many times can I read a resume listing someone’s Microsoft Certifications, get my hopes up that this person has a clue about SharePoint, call the respondent up on the phone to hear them verbally tout their Microsoft Certifications only to learn they don’t know a damn thing about SharePoint?!!?! It happens ALL the time! I’m completely sick of it and can only come to the conclusion that Microsoft Certifications are completely worthless!!! 

Okay… good.. I feel better for getting that out…  now that you are either pissed at me for saying something you disagree with or cheering because you agree, let’s really discuss what the values of Microsoft Certifications in SharePoint are. 

Also.. I must point out that the views I express are not the views of my company… it’s my rant…

The Problem

The problem, from my experience, is that having a Microsoft Certification does not in any way equal knowing HOW to implement the technology. Many times these people can articulate the technology, throw all the buzz words at you, and say things like “Well.. according to Microsoft..”, BUT when faced with a real world SharePoint scenario they don’t have a CLUE where to begin. Having a certification seems to mean that a person has the ability to read and memorize facts, but not necessarily place them in their correct context or know HOW to do anything useful with the technology. What’s worse, there are sites out there where you can basically find the questions asked for a certification so all you have to do is memorize JUST those questions, and pass!  Ugh… For those of us trying to find SharePoint people who can hit the ground running this is just another hurdle and obstacle we have to overcome…  It gets old…. quickly…

So… is there ANY benefit?

This is where I need input from people smarter than myself. As far as I can see the ONLY benefit to having Microsoft Certifications is that for a company to become a Microsoft Certified Partner, the employees have to carry a certain number of certifications. So, the benefit would be that said company would have better access to Microsoft resources to assist a customer. Which, there IS value and benefit there… but there is no guarantee that the people who hold the certifications know more about SharePoint than Sally down the hall who is the Site Owner for your Marketing Department. In fact, there is a good chance Sally knows more because she lives in it every day…

Well… okay then.. what about MCM??

Ahhh… MCM (Microsoft Certified Master)… As worthless as Certifications are is how WORTHWHILE MCM appears to be.  I say “appears” because I am NOT an MCM and the MCMs I do know have always been impressive in their skills. The ONLY problem with MCM is that it’s the other extreme! It’s thousands of dollars and you have to devote, what, a month of your life to living in Seattle to train and pass the tests??

First off… the whole process sounds pretty awesome, but I already work 12 –14 hours a day more days a week than I should.  How can I afford the time or money for MCM training? Plus, I’m not entirely sure I’m smart enough. 

Also, look at the prerequisites for MCM SharePoint Server 2010 :

1.A thorough understanding of Microsoft SharePoint Server 2010 design and architecture.

2.A thorough understanding of Microsoft ASP.NET, Windows Server, Internet Information Services, and other core technologies upon which SharePoint Products and Technologies depend.

3.The ability to speak, understand, and write in fluent English.

4.The following experience:

  • Hands-on experience via early adoption programs with Microsoft SharePoint Server 2010: installing, configuring, troubleshooting, and custom development
  • Three or more years of hands-on experience with Microsoft Office SharePoint Server 2007: installing, configuring, troubleshooting, and custom development

5.Candidates must have passed the following exams prior to applying to the program:

  • Exam 70-573: TS: Microsoft SharePoint 2010, Application Development
  • Exam 70-576: PRO: Designing and Developing Microsoft SharePoint 2010 Applications
  • Exam 70-667: TS: Microsoft SharePoint 2010, Configuring
  • Exam 70-668: PRO: SharePoint 2010, Administrator

Did you see those last prerequisites? You have to have Certifications… So… the value of Certifications is that they allow your company to become a Microsoft Certified Partner AND they are needed to enroll in the MCM Program?  But it STILL doesn’t mean you KNOW anything!?!?

    Okay… so.. stop whining and come up with a solution

    Despite all my ranting… I do conceptually see the value of Microsoft Certifications, and I DO think from a conceptual standpoint they are worthwhile… but how can things be changed so that if a person has a certifications it actually MEANS something? How can we make it a REAL checkmark on a set of requirements to know that if a person has a certification then they DO have some value other than making sure we have “X” certified employees.

    Well.. I have no solution. I have some ideas, but don’t know how to implement them… which is good, because I’m a nobody anyway… Smile

    But what about adding a couple options for prerequisites (lesser than the MCM) before you can take a test for a Microsoft Certification, like:

    Documented Real World Experience

    Let’s face it… 85% of what you actually do in SharePoint is not what you read in books or was taught in a class. It’s the other stuff you fight with day in and day out that your book didn’t mention because it seems like sometimes the exceptions are the norms in SharePoint. (nice run on sentence there Rackley) So, who cares if you “memorized” the norms! How about you have to have documented 6 months experience with the technology you are getting certified for? 6 months is not THAT long, and it’s long enough to get your hands dirty in the real world.


    Certified Training Course

    So, just not patient enough to wait 6 months working with SharePoint in the real world? How about Microsoft and some training companies like MindSharp and Critical Path spend some time together to come up with a “Microsoft Certification Accredited Course” and in order to take a test for certification you had to pass this course with a proficiency?  It could be a week long course and come out with some value there. 

    Why don’t we just change the Certification Test??

    I am NOT suggesting Microsoft revamp everything and start over. That’s not practical with certain structures in place like the MCM prerequisites. I’m not suggesting that the TESTS have to change at all… Just put up a few prerequisites before you can have a certification so that they have SOME meaning.


    Again, my points concerning Microsoft Certifications are:
    1. Having a certification does not mean a person knows how to use the technology
    2. It’s too easy to memorize the questions / answers and pass the tests
    3. They have value for Microsoft Certified Partner status and as prerequisites for MCM training.
    4. Something needs to be done so that having a certification means SOMETHING about a person’s knowledge and skill.
    5. Maybe with the addition of some simple prerequisites for the certification process things can be greatly improved:

a. 6 months documented real world experience or…

b. Accredited training courses

6. I’m not suggesting the entire process needs to be revamped, just do something to ensure it has some meaning!

I realize some people may strongly disagree with me, and I would LOVE to hear some FACTS that would bring more light to the subject. This blog is based on MY experiences and on experiences others have had as well… These experiences are real… and so is my frustration with the process…

My most excellent buddy Dan Usher (@usher) did a post from a different context and more optimistic point of view as well.. great insights.. check it out at:

You aren’t the Lone Ranger anymore… Working Effectively in a Team Environment

So, the similarities between the tech bubble of the late 90’s and the current hiring frenzy of SharePoint people is too similar to ignore. It seems as though if you put SharePoint on your resume SOMEONE will hire you. This of course is good and bad.  Bad because people who don’t know what they are doing are creating huge messes, and good because those who know what they are doing can make more-money-than-they-are-worth cleaning up those messes.

Another artifact coming from this SharePoint Bubble is that there are many SharePoint “Go To” guys and gals out there that are getting snagged up to work in higher profile settings. You know the ones I’m talking about. They are THE person in their organization that “gets stuff done” in SharePoint. They are their company’s rock star. If something is getting done in SharePoint, it is most likely this guy or gal doing it. Very often these inter-company gurus are doing exactly what they SHOULD be doing, and capitalizing on their efforts to boost their career. They are leaving their organization, taking a nice pay increase, and diving head first into bigger and better things. 

Many times these talented people find themselves in an environment totally alien to them. They are no longer “the” expert, but are now part of a team. Many times they are moving from the corporate world to the consulting world and they find out their actions have farther reaching implications. They find themselves tripping over other people, getting frustrated that they aren’t producing as much as they’d like, and coping with greater responsibility.

Well.. fear not… things don’t have to be so frustrating. With the right attitude and work ethic these people can seamlessly integrate into a team and have a huge beneficial impact. 

Some quick tips for those of you considering such a move or who have made such a move:

Cowboy… don’t be one…

If you aren’t Eric Shupps… or if you don’t wear a cowboy hat on a daily basis, you are most likely NOT a cowboy. Stop acting like one. You are part of a team now. You are not autonomous. The actions you take impact more than just yourself. You can’t go off on your own because you have a really cool idea and not tell anyone what you are doing!  Don’t get me wrong, it’s really cool that you have the passion to go play with “x” to solve “y”.. however, if you are supposed to be working on “z” this is not a good thing!  Get your work done first so that other people not are waiting on you, then go play.

Consequences of being a cowboy:

  • Hat hair and musty cow-like smell.. oh yeah.. not that cowboy
  • Missed deadlines because you weren’t doing what you should be doing
  • Team members missed deadlines because they are waiting on you to get your work done
  • Wasted time because you decide to research something that was already researched
  • More wasted time and frustration from your bosses because you work on something that is NOT a priority

Communicate! How else will you know who to blame?

Now that you are part of a team, make sure you communicate effectively with your team. If only there was SOME tool out there that would make collaboration more accessible!!!  But seriously, let people know what you are working on. Let them know when you need help. Know what others are working on so you can help them. This is probably the biggest thing you need to learn to do is communicate effectively and LEARN to communicate with the different team members. Sometimes it can seem like everyone has their own way of communicating. 

Learn to communicate simply and succinctly. No one wants to read a 5 page email, especially one that can be summarized in two sentences.

Some consequences of not communicating well? Wow.. there’s a lot.. including:

  • Missed deadlines
  • Multiple people working on same item/issue
  • Overwriting someone else’s work
  • Work doesn’t get done because “someone else” was doing it
  • Reinventing the wheel when someone else has already done the same thing

Which bring us too…

The Wheel… don’t reinvent it…

Did I mention you are part of a team now? Take advantage of it…learn from those who came before you. Before undertaking any new task, find out what others have done. If you are coming into an established organization there are usually some standards and practices in place to address common development issues.

Consequences of reinventing the wheel:

  • Missed deadlines
  • Wasted time developing something that was already written
  • Developing something poorly that has already been written better
  • Did I mention wasting lots of time?

Directly related is…

Wheels… don’t spin them…

I already did a whole blog post on how to stop spinning your wheels… so.. you have no excuses… just don’t do it..

Stop Spinning Your Wheels… Sage Advice for Aspiring Developers


Consequences of spinning your wheels:

  • Missed deadlines
  • Team member’s work can’t get done
  • Wastes valuable time

Consistency… consistency… CONSISTENCY…

Your new mantra is “I’m part of a team now.. I’m part of a team now”… part of that is learning to code consistently with the rest of your team. Use the same naming conventions and code structure. DOCUMENTING these should be a priority so that everyone is on the same page.

I don’t care if you found a new cool method for doing “x”… unless there is a real benefit, don’t use it!  And if there IS a real benefit, sit down with your team and COMMUNICATE it! Many times there is a very good reason for why things are done a certain way and the method you found was not used!  Or maybe no one thought of your method and here’s your chance to teach the team something and PLAN how to implement your cool new method and make it CONSISTENT throughout the code.

Consequences for not being consistent:

  • Missed deadlines
  • Overly complicated code that other developers can’t understand
  • Introduced errors because of lack of understanding of previous methods
  • Wasted time as team members have to learn multiple ways to do the same thing

Prioritize! Learn to do it…

A crucial skill that many developers have to learn is how to prioritize their time and tasks.  Many times your tasks will get prioritized for you, but this does not negate the necessity to learn this skill! All too often our mangers will change priorities on us without thinking about the impact to our other tasks. Being able to effectively understand priorities will allow us to COMMUNICATE the impact of these changing priorities. Also, having the ability to prioritize will help you meet all your deadlines and not bottleneck the rest of the team.

Consequences of miss prioritized work:

  • Missed deadlines
  • You become the bottleneck for other people
  • Loss of visibility of important tasks

Production…. develop for it…

I address this somewhat in my “Stop Spinning Your Wheels” blog post as well.. but an important aspect to not being a lone ranger anymore is learning to develop for production.  More than likely at your former job you would log directly into your production server, make some tweaks, and come away the hero!!! Yay! Go you!  Well… You can’t do that anymore. Often times you will now find yourself working in a more structured development environment that must be deployed to a production environment. There are nuances you need to understand and take into account. For instance, learn to ALWAYS use relative paths for your URLs otherwise things that work in development will break in production. Avoid hardcoding scripts in your pages in SharePoint Designer (what happens if SPD is locked out of the production environment and you need to tweak something?).  Don’t hard code strings in your code,etc.. etc.. etc…  This one goes hand in hand with Consistency as well.

Consequences of not developing for production:

  • Missed deadlines
  • Broken functionality
  • Inability to maintain code effectively
  • Frustrated team members trying to figure out what you did

Copies and Backups… A lesson you only need to learn once…

So, yes, this is hopefully a lesson you only have to learn once. If you are modifying someone else’s file, project, code, site, etc… make SURE you create a back up first utilizing Source Code Control, taking a site collection backup with stsadm, or simply making a copy of the file and working from the copy. Failure to do so can be catastrophic. Sure, 90% of time this may not be an issue, but what happens when that other 10% occurs and SharePoint does what she does best and decides to totally corrupt your file or site to where it is unusable and you have no way of going back? There’s nothing quite like that dread that sets in when you realize you have destroyed something with no way to recover it… 

Consequences are vast and many including:

  • Missed deadlines
  • Lost work that must be re-developed
  • Loss of site and data that cannot be recovered and you better start looking for another job

Deadlines… it’s not a suggestion…

Anyone else notice a theme with the consequences? If you don’t get a handle on working effectively in a team environment you are at the very least going to start missing deadlines left and right. And you know what? That’s OKAY to happen every now and then when you are learning… BUT COMMUNICATE this with your team! If you give a deadline, you must either meet that deadline or inform your team well in advance that you won’t meet the deadline so everyone can adjust their expectations… Many times expectations will have to be adjusted for clients so this can become a VERY big deal. A deadline is not a suggestion, it’s an expectation. Learn to meet them and to recognize the warning signs for when they will be missed.

Patience… have some…

Finally… a big one for me personally. Be patient with those learning to work in a team environment. Encourage them and don’t chastise them (unless they keep making the same mistakes over and over and over, then feel free to thump them on the head). You might actually learn a thing or two yourself.

So.. these are just some suggestions to help make your life easier and lessen everyone’s frustration level. Some of this may be common sense, and some of this may be foreign to you. Regardless, if you find yourself failing in one of these areas, give it some thought and try to improve. Let’s face it, we should all be striving to improve our skills all the time.. if we aren’t growing then we are getting stale and ineffective.

Also, this is just what I was able to come up with off the top of my head, what suggestions do you have for being an effective team member?

SharePoint Saturday St. Louis Wrap Up

So.. SharePoint Saturday St. Louis was this past weekend and I had the honor of presenting my SharePoint & jQuery session.  This session is always a lot of fun and seems to always produce some really interesting conversation from the attendees. Seems like I learn something every time I do it. 

Thanks to all those who attended and contributed and thanks to Matt Bremer (@mattbremer) and crew for putting on a great event!

As promised, here’s the link to the slide deck:


Also, I’m always looking for new blog ideas, so if there is something specific you want to see involving SharePoint & jQuery let me know and I’ll see what I can do!

Next up for me is SPTechCon in Boston in June. Come say hi if you are going to be around!

Using Google Maps to Populate an Address in a SharePoint New Item Form

Only a truly geeky developer can understand the concept that I’ve been working and writing so much code lately they I need to take a break by… well.. writing more code…

Anyway! My brain needed a break from my current assignments so I decided to tackle a question I saw posted about populating address fields in SharePoint with a click on a location from a map plugin. It seemed like a nice challenge and something I KNEW could be tackled as long as the proper map API existed… This turned out to be super simple when all was said and done…

By the way this works in both SharePoint 2010 and the SharePoint formerly known as MOSS.

Google Maps or Bing?

At first I needed to decide whether to use Google Maps or Bing Maps… I was really hoping to take advantage of Bing because, well.. you would think it would make more sense to have two Microsoft products working together. Unfortunately, I could not find any way to “Reverse Geocode” (basically get an address from a latitude and longitude) out of the box with Bing.  I’m assuming there’s an additional web service I could call to get an address from a Lat/Long, but I just wanted to get a proof of concept going and show it could be done. So, if you just HAVE to use Bing, you could, but you need to find a Web Service that will get the address for you.

Fortunately, Google Maps already has the functionality for Reverse Geocoding built in so I didn’t have to do any additional web service calls or research. I decided to go with that. Smile  I first looked at using V3 of Google Maps, but apparently it uses HTML 5 and we all know how well IE plays with HTML 5.  So, I dropped back down to V2. I imagine the code for V3 would be very similar.  I found 95% of what I needed in the Google Maps Documentation under the “Reverse Geocoding” section at: 

The Script

Under the aforementioned section is an example that uses Reverse Geocoding.. like I said.. this is 95% of what you need.  It looks like:

var map;
var geocoder;
var address;

function initialize() {
  map = new GMap2(document.getElementById("map_canvas"));
  map.setCenter(new GLatLng(40.730885,-73.997383), 15);
  map.addControl(new GLargeMapControl);
  GEvent.addListener(map, "click", getAddress);
  geocoder = new GClientGeocoder();

function getAddress(overlay, latlng) {
  if (latlng != null) {
    address = latlng;
    geocoder.getLocations(latlng, showAddress);

function showAddress(response) {
  if (!response || response.Status.code != 200) {
    alert("Status Code:" + response.Status.code);
  } else {
    place = response.Placemark[0];
    point = new GLatLng(place.Point.coordinates[1],place.Point.coordinates[0]);
    marker = new GMarker(point);
        '<b>orig latlng:</b>' + + '<br/>' + 
        '<b>latlng:</b>' + place.Point.coordinates[1] + "," + place.Point.coordinates[0] + '<br>' +
        '<b>Status Code:</b>' + response.Status.code + '<br>' +
        '<b>Status Request:</b>' + response.Status.request + '<br>' +
        '<b>Address:</b>' + place.address + '<br>' +
        '<b>Accuracy:</b>' + place.AddressDetails.Accuracy + '<br>' +
        '<b>Country code:</b> ' + place.AddressDetails.Country.CountryNameCode);

From looking at this example Script you can see under the “showAddress” function it is popping up a “marker” with the address (place.address).  We simply need to grab this address and push it to our SharePoint Form.  The address is in one long string “1234 Main St., Harrison, AR 72601, USA” so we will need to parse the string to break out each individual element.  For the purposes of this prototype I just did a split at the commas and spaces, this works a majority of the time for US addresses but no way in the world will it work for most countries or street addresses that may contain a comma.  So, again, this is not production quality code, you aren’t paying me for that. That quick and dirty code looks like:

var values = place.address.split(",");
var address = values[0];
var city = values[1];
var state = values[2].split(" ")[1];
var zip = values[2].split(" ")[2];
var country = values[3]

Now we need to stuff these values into our SharePoint form fields. jQuery makes this very easy.  You can set a SharePoint Form field on the New and Edit forms using the syntax “$("input[title='<field name>']").val(<value>);”.  So the previous code becomes:

var values = place.address.split(",");
var address = values[0];
var city = values[1];
var state = values[2].split(" ")[1];
var zip = values[2].split(" ")[2];
var country = values[3]

This of course assumes your SharePoint List has the fields “Country”, “Zip”, “State”, “City”, and “Address”.  If not, change the script accordingly.  So, when we add our modifications to the example from Google we get (note that I removed the ‘pop-up’ marker that was there before, you can leave that in there if you want):

 var map;
    var geocoder;
    var address;
    function initialize() {
      map = new GMap2(document.getElementById("map_canvas"));
      map.setCenter(new GLatLng(40.730885,-73.997383), 15);
      GEvent.addListener(map, "click", getAddress);
      geocoder = new GClientGeocoder();
    function getAddress(overlay, latlng) {
      if (latlng != null) {
        address = latlng;
        geocoder.getLocations(latlng, showAddress);
    function showAddress(response) {
      if (!response || response.Status.code != 200) {
        alert("Status Code:" + response.Status.code);
      } else {
        place = response.Placemark[0];
        point = new GLatLng(place.Point.coordinates[1],
        marker = new GMarker(point);
        var values = place.address.split(",");
        var address = values[0];
        var city = values[1];
        var state = values[2].split(" ")[1];
        var zip = values[2].split(" ")[2];
        var country = values[3]

Okay.. that’s all fine and dandy, but we need to format this in such a way that we can drop it into a js file that we can easily use it in SharePoint by linking a CEWP to it. We also need to make sure to load the GoogleMaps library and jQuery. You will also need to request a Google Maps API Key from Google. It’s a completely painless process. So, when we do all that, our script becomes:

<script type="text/javascript" src=;v=2&amp;key=<GET YOUR OWN GOOGLE MAP KEY>></script>
<script type="text/javascript" src="../../scripts/jquery.min.js"></script>

<script type="text/javascript">

   var map;
    var geocoder;
    var address;
    function initialize() {
      map = new GMap2(document.getElementById("map_canvas"));
      map.setCenter(new GLatLng(40.730885,-73.997383), 15);
      GEvent.addListener(map, "click", getAddress);
      geocoder = new GClientGeocoder();
    function getAddress(overlay, latlng) {
      if (latlng != null) {
        address = latlng;
        geocoder.getLocations(latlng, showAddress);
    function showAddress(response) {
      if (!response || response.Status.code != 200) {
        alert("Status Code:" + response.Status.code);
      } else {
        place = response.Placemark[0];
        point = new GLatLng(place.Point.coordinates[1],
        marker = new GMarker(point);
        var values = place.address.split(",");
        var address = values[0];
        var city = values[1];
        var state = values[2].split(" ")[1];
        var zip = values[2].split(" ")[2];
        var country = values[3]



 <div id="map_canvas" style="width: 500px; height: 400px"></div> 

Integrating Into SharePoint

Okay, now that the script is complete, we need to get it integrated in SharePoint and working on a SharePoint page that contains our NewForm (or EditForm) that we want to populate.  You will need to:

1) Upload the script above to a document library (along with jQuery.min if you haven’t done so already)

2) Create a new page and place a “New Item Form” or “Edit Item Form” for your list item on it (or use the default NewForm.aspx or EditForm.aspx)

3) Place a Content Editor Web Part (CEWP) on the page (you can get the default page into edit mode in SharePoint 2007 by appending “&ToolPaneView=2” in the url for the page.)

4) In the “Content Link” section of the Web Part Properties of the CEWP, put the path to your script from #1 above.

image image

SharePoint 2007

SharePoint 2010

5) That’s it! Your done! Save the page / stop editing / whatever…

Seriously? That’s it?

Yep.. that’s it… Now when you click on a location on the map, the corresponding fields should be populated with the address from the Google Map.  Click on OK to save your entry.


Again, you would need to tweak the script to make it work for ALL address types… but you can handle that can’t you?

Still don’t believe me? Well, you can try out a live demo thanks to the awesome Mack Sigman (@Mack_Sigman) who set up a site collection for me so I could show you guys this tip.


Okay.. You’re not impressed.. What’s next?

So… I decided to add another field to my Address list that stores the address unparsed. I then dropped a DVWP on the page that displays all the addresses and added a column that pushes this unparsed address back to the Google Maps API to display the location on the map. Feel free to play with that too.


Remember my mantra? Use the KISS principle… after getting  a decent nights rest I realized it made zero sense to store the unparsed address as separate field to push back to Google Maps for two big reasons:

1) If you manually enter an address there is no “unparsed” address to store.

2) It’s making a simple problem more difficult.

What I ended up doing was creating a new Calculated Column field that concatenates the address fields in the form and then that calculated field is what I push to Google Maps.  So, you Mavericks that are manually inputting an address and saying “haha.. it doesn’t work”.. well.. that works now…

So.. basically… you SHOULD be able to enter any address manually, save it, and then click the “View In Map” link to see it in the map.

I also added a button just above the Map… If you manually enter an address then click that button, the map should display that address (kind of a poor man’s address verification?). 



Hope you learned something, or at least weren’t completely bored… Thanks again for stopping by.

Setting SharePoint Lookup Lists w/ jQuery (+/- 20 items)

So… A while back I had to set a SharePoint Lookup drop down list value with JavaScript and ran into the quirk where SharePoint handles Lookup drop downs differently if there are 20 or more items in the list. I’m not exactly sure why SharePoint does this. The only common sense reason I can think of is to pass less data over the wire, but if this were the case why not just be consistent and do the same thing ALL the time????  I guess that would make too much sense.

Anyway, this week I had to do it again, and well, I couldn’t remember exactly how I did it the last time. I did some Googling with Bing and didn’t get the answer I was looking for. I’m SURE this has to be blogged somewhere, but whoever you are you didn’t title it well enough and I didn’t find you! So, I decided to blog it myself… oh, and thanks to Mr. Marc Anderson for being my sanity checker and making sure I was heading in the right direction.

This works for BOTH SharePoint 2010 and the SharePoint formerly known as MOSS by the way…

The Problem

Like I said earlier, someone had the BRILLIANT idea that SharePoint should handle Lookup drop down lists differently if there are 20 or more items in a list… In fact, I can picture how that might have gone… picture if you will…..

A couple of developers, up late at night, just got done with a marathon session of WoW (That’s World of Warcraft for you normal folks)… fingers covered in the yellow deliciousness that is cheetos.. maybe they had a few too many wine coolers…. They reminisce about how awesome Zima was and how they miss their MC Hammer Pants from high school…  Oh crap.. they forgot they had some work they had to do… so they start coding… intoxicated and emotionally high from their latest raid in Darnassus… One guy just bursts out laughing… “Dude!!  Look at this code I wrote!!!  Dare me to commit it???”  “Do it dude!!! I double dare you!!!”

And behold… SharePoint’s handling of Lookup fields with 20 or more entries… I’m kidding of course, I’m sure there is a completely valid reason for why they did it.. I’m probably just not smart enough to understand… so, if you are that developer, I apologize for poking fun out of ignorance… now get back to your game…

The Solution

So… anyway… when you create a Lookup field in SharePoint and there are less than twenty items in the drop down list the html that is generated on the new and edit forms looks something like:

<select name="ctl00$m$g_50e06708_50bb_4560_ab4c_6c3c5a95a113$ctl00$ctl04$ctl01$ctl00$ctl00$ctl04$ctl00$Lookup" 
                    <option value="0">(None)</option>
                    <option value="8">eight</option>
                    <option value="5">five</option>
                    <option value="4">four</option>
                    <option value="9">nine</option>
                    <option value="1">one</option>
                    <option value="7">seven</option>
                    <option value="6">six</option>
                    <option value="10">ten</option>
                    <option value="3">three</option>
                    <option value="2">two</option>

Okay, aside from the HIDEOUS generated name and id, this is exactly what you would expect.  Also note that it is using the Display Name of the field with an attribute called “title” this is uber important when it comes to setting these values with jQuery. We can use the “title” attribute instead of having to know what the elements id is… So, setting the value of a drop down list with 20 or less items is quite easy and can be done with one line of jQuery. If we wanted the above drop down box to display the option with a value of “2”, the jQuery would look like:


Simple? eh? We tell jQuery we are looking for a “select” element with a “title” attribute equal to “Numbers” and we set the value to “2”.  It is important to note, we are setting the OPTION value, not the text displayed in the drop down list. 

Well… what happens if there are more tan 20 items?  Well… ladies and gentlemen… I’m glad you asked… Here is how the same field looks when there are MORE than 20 items:

<input name="ctl00$m$g_50e06708_50bb_4560_ab4c_6c3c5a95a113$ctl00$ctl04$ctl01$ctl00$ctl00$ctl04$ctl00$ctl01" 
class="ms-lookuptypeintextbox" onfocusout="HandleLoseFocus()" opt="_Select" 
optHid="SPNumbers_Hiddenctl00$m$g_50e06708_50bb_4560_ab4c_6c3c5a95a113$ctl00$ctl04$ctl01$ctl00$ctl00$ctl04$ctl00" onkeypress="HandleChar()" onkeydown="HandleKey()" match="" 
onchange="HandleChange()" />

Holy crap… reallly? Did you SEE that? We no longer have a select element, we now have an INPUT element… that’s right… the drop down list you actually see is generated using the event handlers in the element. Now, I’ve never dissected these events to see exactly what they are doing (and frankly I don’t care).  What I care about is getting my drop down value set…. Ah… but slow down there rookie, what you also don’t understand yet (or you do understand, and just reading my blog because you are bored) is that this input field is NOT what is being stored when you press that “Ok” button to save your changes.  This input is strictly for display purposes. See that attribute in the element called “optHid”. That’s another important attribute. This attribute is the ID of a HIDDEN INPUT element that is ACTUALLY the element that we need to set in order for our selection to be saved:

<input type="hidden" 
value="0" />

My head hurts… Where was I? Oh.. Yes… se we actually need to set the value of the HIDDEN input element not the value of some select element or the value of the VISIBLE input, that would just be silly!!!  So… we can use the “title” attribute from the visible element along with the “optHid” attribute to find the hidden input and set it. So, if we wanted to set the value of THIS Lookup field to “2” that jQuery would look like:

hiddenInput = $("input[title='Numbers']").attr("optHid");
$("input[id='" +hiddenInput +"']").attr("value","2")

In this instance we are looking for the “input” element (not select like we did before) that has the “title” attribute set to “Numbers. We are then looking for the “optHid” attribute from that element and storing it in a variable called “hiddenInput”. We then look for the “input” with the “id” equal to the value of the “optHid” attribute. and we are setting the value of that input to “2”. 

I should point out here that $("input[id='" +hiddenInput +"']").attr("value","2")  SHOULD be the same as $("#" +hiddenInput).val(”2”); unless there is something I don’t know about hidden inputs, BUT for some reason that didn’t work for me…  I’m 99.5% sure I didn’t fat finger it, but oh well.. if it works for you, more power to you. Smile

So… we SET the value for the hidden input that is responsible for storing the value in the list, but we can’t forget about that pesky input element that is used to display the selected lookup entry. If we just set the value of the hidden field IT WILL SAVE THE CORRECT VALUE when you press “OK” even though no option will be displayed in the visible lookup field. When the page reloads the correct value will be displayed in the lookup field.  If you want the text to display for your Lookup field when you set it, we are not quite done… we also need to set the correct value in the displayed input. I used this little piece of script to accomplish that:

choices = $("input[title='Numbers']").attr("choices");
        choiceArray = choices.split("|");
        for (index = 1; index < choiceArray.length; index = index + 2)
            if (choiceArray[index] == lookupVal){
                $("input[title='Numbers']").val(choiceArray[index - 1]);    

Now.. I’m not enamored with this script and know there is a more efficient way to write it, but it works and it’s easy to understand (KISS principle).  What I’m doing is getting that string of choices which looks like "(None)|0|eight|8|eightteen|18|eleven|11|fifteeen|15…”.  As you can see it’s a string that is the select text, pipe character, select value, pipe character… etc…  So, I take this string of choices and “split” it at the “|” to turn it into an array. Now we can index each option value and text.  That’s what I’m doing in my for loop, I’m searching through the array for my “value” that I’m trying to set. When I find my value, I have to back up one in my array to get the text that I want to display in the visible text box and display it.  Not too hairy hopefully?

Put it all together

Okay.. we really need to put these two solutions together in one function that can determine which method to use.. right? Understand? Comprendo? That function would look something like:

function SetLookup( fieldTitle, lookupVal)
    //Set default value for lookups with less that 20 items
    if ( $("select[title='" +fieldTitle+ "']").html() !== null)
       $("select[title='"+ fieldTitle +"']").val(lookupVal);    
        choices = $("input[title='" +fieldTitle +"']").attr("choices");
        hiddenInput = $("input[title='" +fieldTitle +"']").attr("optHid");
        $("input[id='" +hiddenInput +"']").attr("value",lookupVal)
        choiceArray = choices.split("|");
        for (index = 1; index < choiceArray.length; index = index + 2)
            if (choiceArray[index] == lookupVal){
                $("input[title='" +fieldTitle +"']").val(choiceArray[index - 1]);    

This function takes two parameters… the Title (Display name) of the Lookup field we want to set, and the value we want to set it to. I’ve used this both in 2007 and 2010 and it worked like a charm.

Okay… but WHERE the heck would I use this?

Actually… there is a GREAT reason to use this in conjunction with my Parent/Child list relationship post.  In that post I have you modifying the NewForm.aspx page in SharePoint Designer which un-Ghosts (customizes) the page and I’m not particularly crazy about doing that.  What you can do instead is put a Content Editor Web Part on the NewForm.aspx page and use this script to set the value of the drop down in conjunction with the Query String Variable. So, the final script for that would look like like the script below (Notice I changed the Lookup field name to match the field in my previous blog).

Oh wait? You don’t know how to edit the NewForm.aspx page or EditForm.aspx page in SharePoint because there is no “Edit Page” option?  All you have to do is append “&ToolPaneView=2” to the URL of the page to get it in Edit Mode (replace the “&” with “?” if there are no other Query String Variables).

<script src="/scripts/jquery.min.js" type="text/javascript" ></script>

<SCRIPT type=text/javascript>     

    //get "IssueID" from Query String
     var vals = new Object();
      var qs =,;
      var args = qs.split("&");
      for (var i=0; i < args.length; i++) {
       var nameVal = args[i].split("=");
       var temp = unescape(nameVal[1]).split('+');
       nameVal[1] = temp.join(' ');
       vals[nameVal[0]] = nameVal[1];
      var issueID = vals["IssueID"];

      //Set the Lookup field with dislay name of "IssueID" to the item with value from Query String

function setLookup( fieldTitle, lookupVal)
    //Set default value for lookups with less that 20 items
    if ( $("select[title='" +fieldTitle+ "']").html() !== null)
       $("select[title='"+ fieldTitle +"']").val(lookupVal);    
        //get the hiddent input using the "optHid" attribute of displayed Input
        hiddenInput = $("input[title='" +fieldTitle +"']").attr("optHid");
        //set value in the hidden input
        $("input[id='" +hiddenInput +"']").attr("value",lookupVal)

        //get the string of choices from the input element so we can set displayed value
        choices = $("input[title='" +fieldTitle +"']").attr("choices");
        //turn choices string into an array so we can iterate through it
        choiceArray = choices.split("|");
        //improve performance by iterating over every other entry (just look at values)
        for (index = 1; index < choiceArray.length; index = index + 2)
            if (choiceArray[index] == lookupVal){
                //set the displayed input which is the PREVIOUS entry in array
                $("input[title='" +fieldTitle +"']").val(choiceArray[index - 1]);    


Okay… so, maybe more than you ever wanted to know about Lookup fields in SharePoint.. but on the bright side I’ll  have the freaking script next time I need it… enjoy… Smile

Essential Links for the SharePoint Client Side Developer

Front End Developer? Client Side Developer? Middle Tier??? I’m covering all my bases.  Regardless, I’m sick and tired of Googling with Bing when I forget where information that I need often is located. I was getting ready to bookmark some of them when it hit me… “Hey Mark… (I don’t actually refer to myself in the third person), Why don’t you put the links in a blog so that it looks like you are being helpful!” I can’t tell you how many times I’ve had to go back to some of my old blogs to remember how I did something. Seriously people, you need to start a blog, it’s the best way to remember how the frick you got something to work… and it looks like you are being helpful when in reality you are just forgetful.  Smile

So… where was I? Oh yeah.. essential information that I’ve needed from time to time when I was not using Visual Studio. All of this info has come in handy from time to time. Know about these things and keep them in your tool belt, it’s amazing the stuff you can accomplish with just knowing where to look.

What Why
SPServices Widely used library written by Marc Anderson used to call SharePoint Web Services with jQuery
jQuery For SPServices and other cool stuff
Easy Tabs Essential tool for quick page enhancements. This widely used too from Christophe Humbert groups multiple web parts into one tabbed display. Very quick and easy way to get oohs and ahs from End Users.
Convert Calculated Columns to HTML Also from Christophe, I use this script all the time to convert html in my calculated columns to actually display as html and not with the tags.

Unlocking the Mysteries of Data View Web Part XSL Tags

This blog series from Marc Anderson makes it very easy to understand what’s going on with all those weird xsl tags in your data view web parts. Essential to make those things do what you want them to do.
Creating Parent / Child list relationships (2007)

Creating Parent / Child list relationships (2010)
By far my most viewed blog posts (tens and tens of thousands).  I have posts for both 2007 and 2010 that walk you through automatically setting the lookup id on a list to its “parent”.
Set SharePoint Form fields using Query String Variables Also widely read, this one walks you through taking a variable from your Query String and set a form field to that value.


Okay, let me add some of the third party jQuery libraries that I routinely use in SharePoint. These are a quick and easy ways to add some “wow” to your pages.

What Why
SimpleModal Do you really like the pop up forms in 2010? Do you wish you could do them in 2007? Or better yet, turn them into a wizard? Display DVWP’s in a pop-op? The possibilities are endless with this simple little library.
g.Raphael Business Users always want pretty pictures, they hate words…so why not use SPServices in conjunction with this library to create pie chars, bar charts, etc… you can even add drill down functionality. Cool stuff.
FullCalendar My MOST favorite third party library for SharePoint in the entire world.. this thing works seamlessly with SPServices to give users the calendar view they REALLY want. Use on any list with a date, color code dates. bring in data from multiple lists into one calendar.  Your one stop shop for calendar awesomeness.
date.js Show of hands, who hates messing with dates and date calculations? Yeah.. I thought so. This library makes it as close to painless as possible.
datetimepicker Nifty easy to use jQuery date and time picker for setting date fields. Uber useful.
Easy Accordion Groovy, easy to use accordion that integrates will with SharePoint… you can even stick your custom web parts and DVWP’s into the accordion if you know what you are doing.


Hmmm… I KNOW there are more, but I’m tired and drawing a blank.  I’ll try to add them when I remember them (or need them again and think “Oh, I forgot to add that one”)

But it’s a start, and please feel free to add your own in the comments…

So, it’s YOUR turn to be helpful. What little tip or trick do you find yourself using ALL the time that you think everyone should know about??

Stop Spinning Your Wheels… Sage Advice for Aspiring Developers

So… lately I’ve been tasked with helping bring some non-developers over the hump and become full-fledged, all around, SharePoint developers. Well, only time will tell if I’m successful or a complete failure. Good thing about failures though, you know what NOT to do next time!

Anyway, I’ve been writing some sort of code since I was about 10 years old; so I sometimes take for granted the effort some people have to go through to learn a new technology. I guess if I had to say I was an “expert” in one thing it would be learning (and getting “stuff” done) in new technologies. Maybe that’s why I’ve embraced SharePoint and the SharePoint community. SharePoint is the first technology I haven’t been able to master or get everything done without help from other people. I KNOW I’ll never know it all and I learn something new every day.  It keeps it interesting, it keeps me motivated, and keeps me involved. So, what some people may consider a downside of SharePoint, I definitely consider a plus.

Crap.. I’m rambling. Where was I? Oh yeah… me trying to be helpful. Like I said, I am able to quickly and effectively pick up new languages, technology, etc. and put it to good use. Am I just brilliant? Well, my mom thinks so.. but maybe not. Maybe I’ve just been doing it for a long time…. 25 years in some form or fashion… wow I’m old… Anyway, what I lack in depth I make up for in breadth and being the “go-to” guy wherever I work when someone needs to “get stuff done”. 

Let’s see if I can take some of that experience and put it to practical use to help new people get up to speed faster, learn things more effectively, and become that go-to guy.

First off…  make sure you…

Know The Basics

I don’t have the time to teach new developers the basics, but you gotta know them. I’ve only been “taught” two languages.. Fortran 77 and C… everything else I’ve picked up from “doing”. I HAD to know the basics though, and all new developers need to understand the very basics of development.  97.23% of all languages will have the following:

  • Variables
  • Functions
  • Arrays
  • If statements
  • For loops / While loops

If you think about it, most development is “if this, do this… or while this, do this…”.  “This” may be some unique method to your language or something you develop, but the basics are the basics. YES there are MANY other development topics you need to understand, but you shouldn’t be scratching your head trying to figure out what a ”for loop” is… (Also learn about classes and hashtables as quickly as possible).

Once you have the basics down it makes it much easier to…

Learn By Doing

This may just apply to me and my warped brain.  I don’t learn a new technology by reading or hearing someone speak about it. I learn by doing. It does me no good to try and learn all of the intricacies of a new language or technology inside-and-out before getting my hands dirty. Just show me how to do one thing… let me get that working… then show me how to do the next thing.. let me get that working… Now, let’s see what I can figure out on my own. Okay.. now it starts to make sense. I see how the language works, I can step through the code, and before you know it.. I’m productive in a new technology.

Be careful here though…. make sure you…

Don’t Reinvent The Wheel

People have been writing code for what… 50+ years now? So, why are you trying to tackle ANYTHING without first Googling it with Bing to see what others have done first?

When I was first learning C# (I had come from a Java background) I had to call a web service.  Sure! No problem! I’d done this many times in Java. So, I proceeded to write an HTTP Handler, called the Web Service and it worked like a charm!!!  Probably about 2.3 seconds after I got it working completely someone says to me “Why didn’t you just add a Web Reference?” Really? You can do that?  oops… I just wasted a lot of time. Before undertaking the development of any sort of utility method in a new language, make sure it’s not already handled for you…

Okay… you are starting to write some code and are curious about the possibilities? Well… don’t just sit there…

Try It And See What Happens

This is actually one of my biggest pet peeves. “So… ‘x++’ works in C#, but does it also work in JavaScript?”   Really? Did you just ask me that? In the time it spent for you to type that email, press the send button, me receive the email, get around to reading it, and replying with “yes” you could have tested it 47 times and know the answer!

Just TRY it! See what happens! You aren’t doing brain surgery. You aren’t going to kill anyone, and you BETTER not be developing in production. So, you are not going to crash any production systems!! Seriously! Get off your butt and just try it yourself. The extra added benefit is that it doesn’t work, the absolute best way to learn is to…

Learn From Your Failures

I don’t know about you… but if I screw up and something doesn’t work, I learn A LOT more debugging my problem than if everything magically worked. It’s okay that you aren’t perfect! Not everyone can be me? Winking smile

In the same vein… don’t ask someone else to debug your problem until you have made a valiant attempt to do so yourself. There’s nothing quite like stepping through code line by line to see what it’s REALLY doing… and you’ll never feel more stupid sometimes than when you realize WHY it’s not working.. but you realize... you learn... and you remember. There is nothing wrong with failure as long as you learn from it.

As you start writing more and more and more code make sure that you ALWAYS…

Develop for Production

You will soon learn that the “prototype” you wrote last week to show as a “proof of concept” is going to go directly into production no matter how much you beg and plead and try to explain it’s not ready to go into production… it’s going to go straight there.. and it’s like herpes.. it doesn’t go away and there’s no fixing it once it’s in there.  So, why not write ALL your code like it will be put in production?

It MIGHT take a little longer, but in the long run it will be easier to maintain, get help on, and you won’t be embarrassed that it’s sitting on a production server for everyone to use and see.

So, now that you are getting comfortable and writing code for production it is important to to remember the…

KISS Principle… Learn It… Love It…

Keep It Simple Stupid

Seriously.. don’t try to show how smart you are by writing the most complicated code in history. Break your problem up into discrete steps and write each step. If it turns out you have some redundancy, you can always go back and tweak your code later. 

How bad is it when you write code that LOOKS cocky? I’ve seen it before… some of the most abstract and complicated classes when a class wasn’t even needed! Or the most elaborate unreadable code jammed into one really long line when it could have been written in three lines, performed just as well, and been SOOO much easier to maintain.

Keep it clear and simple.. baby steps people. This will help you learn the technology, debug problems, AND it will help others help you find your problems if they don’t have to decipher the Dead Sea Scrolls just to figure out what you are trying to do….

Really.. don’t be that guy… try to curb your ego and…

Keep an Open Mind

No matter how smart you are… how fast you type… or how much you get paid, don’t let your ego get in the way. There is probably a better way to do everything you’ve ever done. Don’t become so cocky that you can’t think someone knows more than you. There’s a lot of brilliant, helpful people out there willing to show you tricks if you just give them a chance.

A very super-awesome developer Claudio Lassala (@ClaudioLassala) once said “So what if you’ve been writing code for 10 years or more! Does your code look basically the same? Are you not growing as a developer?” Those 10 years become pretty meaningless if you just “know” that you are right and have not picked up new tips, tricks, methods, and patterns along the way.

Learn from others and find out what’s new in development land (you know you don’t have to specifically use pointers anymore??).

Along those same lines…

If it’s not working, first assume you are doing something wrong.

You have no idea how much it annoys people who are trying to help you when you first assume that the help they are trying to give you is wrong. Just MAYBE… you… the person learning is making some small mistake? Maybe you didn’t describe your problem correctly? Maybe you are using the wrong terminology?

“I did exactly what you said and it didn’t work.”  Oh really? Are you SURE about that?

“Your solution doesn’t work.”  Well… I’m pretty sure it works, I’ve used it 200 times… What are you doing differently?

First try some humility and appreciation.. it will go much further, especially when it turns out YOU are the one that is wrong.

When all else fails….

Try Professional Training

Some people just don’t have the mindset to go and figure stuff out. It’s a gift and not everyone has it. If everyone could do it I wouldn’t have a job and there wouldn’t be professional training available.  So, if you’ve tried everything else and no light bulbs are coming on, contact the experts who specialize in training. Be careful though, there is bad training out there. Want to know the names of some good places? Just shoot me a message and I’ll let you know. I’m boycotting endorsing Andrew Connell anymore until I get that free course dangit!!

So… that’s it.. that’s all I got right now. Maybe you thought all of this is common sense, maybe you think I’m smoking crack. If so, don’t just sit there, there’s a comments section for a reason.

Finally, what about you? What tips do you have to help those foolish souls aspiring to learn the dark arts??

You should NOT be writing jQuery in SharePoint if…

Yes… another one of these posts. What can I say? I’m a pot stirrer.. a rabble rouser *rabble rabble*

jQuery in SharePoint seems to be a fairly polarizing issue with one side thinking it is the most awesome thing since Princess Leia as the slave girl in Return of the Jedi and the other half thinking it is the worst idea since Mannequin 2: On the Move. The correct answer is OF COURSE “it depends”.

But what are those deciding factors that make jQuery an awesome fit or leave a bad taste in your mouth? Let’s see if I can drive the discussion here with some polarizing comments of my own… I know some of you are getting ready to leave your comments even now before reading the rest of the blog, which is great! Iron sharpens iron… These discussions hopefully open us up to understanding the entire process better and think about things in a different way.

You should not be writing jQuery in SharePoint if you are not a developer…

Let’s start off with my most polarizing and rant filled portion of the blog post. If you don’t know what you are doing or you don’t have a background that helps you understand the implications of what you are writing then you should not be writing jQuery in SharePoint!

I truly believe that one of the biggest reasons for the jQuery haters is because of all the bad jQuery out there. If you don’t know what you are doing you can do some NASTY things! One of the best stories I’ve heard about this is from my good friend John Ferringer (@ferringer). John tells this story during our Mythbusters session we do together. One of his clients was undergoing a Denial of Service attack and they couldn’t figure out what was going on! After much searching they found that some genius jQuery developer wrote some code for an image rotator, but did not take into account what happens when there are no images to load! The code just kept hitting the servers over and over and over again which prevented anything else from getting done! Now, I’m NOT saying that I have not done the same sort of thing in the past or am immune from such mistakes. My point is that if you don’t know what you are doing, there are very REAL consequences that can have a major impact on your organization AND they will be hard to track down.  Think how happy your boss will be after you copy and pasted some jQuery from a blog without understanding what it does, it brings down the farm, AND it takes them 3 days to track it back to you.  :/ Good times will not be had.

Like it or not JavaScript/jQuery is a programming language. While you .NET people sit on your high horses because your code is compiled and “runs faster” (also debatable), the rest of us will be actually getting work done and delivering solutions while you are trying to figure out why your widget won’t deploy. I can pick at that scab because I write .NET code too and speak from experience. I can do both, and do both well. So, I am not speaking from ignorance here.

In JavaScript/jQuery you have variables, loops, conditionals, functions, arrays, events, and built in methods. If you are not a developer you just aren’t going to take advantage of all of that and use it correctly.

Ahhh.. but there is hope! There is a lot of jQuery resources out there to help you learn and learn well! There are many experts on the subject that will gladly tell you when you are smoking crack.

I just this minute saw a tweet from @cquick with a link to: “jQuery Fundamentals”. I just glanced through it and this may be a great primer for you aspiring jQuery devs.

Take advantage of all the resources and become a developer! Hey, it will look awesome on your resume right?

You should not be writing jQuery in SharePoint if it depends too much on client resources for a good user experience

I’ve said it once and I’ll say it over and over until you understand. jQuery is executed on the client’s computer. Got it? If you are looping through hundreds of rows of data, searching through an enormous DOM, or performing many calculations it is going to take some time! AND if your user happens to be sitting on some old PC somewhere that they picked up at a garage sale their experience will be that much worse! If you can’t give the user a good experience they will not use the site. So, if jQuery is causing the user to have a bad experience, don’t use it. I sometimes go as far to say that you should NOT go to jQuery as a first option for external facing web sites because you have ZERO control over what the end user’s computer will be. You just can’t guarantee an awesome user experience all of the time.

Ahhh… but you have no choice? (where have I heard that before?). Well… if you really have no choice, here are some tips to help improve the experience:

Avoid screen scraping

This is not 1999 and SharePoint is not an old green screen from a mainframe… so why are you treating it like it is? Screen scraping is time consuming and client intensive. Take advantage of tools like SPServices to do your data retrieval when possible.

Fine tune your DOM searches

A lot of time can be eaten up just searching the DOM and ignoring table rows that you don’t need. Write better jQuery to only loop through tables rows that you need, or only access specific elements you need. Take advantage of Element ID’s to return the one element you are looking for instead of looping through all the DOM over and over again.

Write better jQuery

Remember this is development. Think about how you can write cleaner, faster jQuery. This directly relates to the previous point of improving your DOM searches, but also when using arrays, variables and loops. Do you REALLY need to loop through that array 3 times? How can you knock it down to 2 times or even 1? When you have lots of calculations and data that you are manipulating every operation adds up. Think about how you can streamline it. Back in the old days before RAM was abundant, Cores were plentiful and dinosaurs roamed the earth, us developers had to take performance into account in everything we did. It’s a lost art that really needs to be used here.

You should not be writing jQuery in SharePoint if you are sending a lot of data over the wire…

Developer:  “Awesome… you can easily call SharePoint’s web services to retrieve and write data using SPServices!”

Administrator: “Crap! you can easily call SharePoint’s web services to retrieve and write data using SPServices!”

SPServices may indeed be the best thing that happened to SharePoint since the invention of SharePoint Saturdays by Godfather Lotter… BUT you HAVE to use it wisely! (I REFUSE to make the Spiderman reference). If you do not know what you are doing your code will bring back EVERY field and EVERY row from a list and push that over the internet with all that lovely XML wrapped around it. That can be a HUGE amount of data and will GREATLY impact performance! Calling several web service methods at the same time can cause the same problem and can negatively impact your SharePoint servers.

These problems, thankfully, are not difficult to rectify if you are careful:

Limit list data retrieved

Use CAML to reduce the number of rows returned and limit the fields returned using ViewFields.  You should definitely be doing this regardless. If you aren’t I hope your admin thumps you upside the head.

Batch large list updates

You may or may not have noticed that if you try to do large updates (hundreds of rows) that the performance is either completely abysmal or it fails over half the time. You can greatly improve performance and avoid timeouts by breaking up your updates into several smaller updates. I don’t know if there is a magic number for best performance, it really depends on how much data you are sending back more than the number of rows. However, I have found that 200 rows generally works well.  Play around and find the right number for your situation.

Delay Web Service calls when possible

One of the cool things about jQuery and SPServices is that you can delay queries to the server until they are actually needed instead of doing them all at once. This can lead to performance improvements over DataViewWebParts and even .NET code in the right situations. So, don’t load the data until it’s needed. In some instances you may not need to retrieve the data at all, so why retrieve it ALL the time?

You should not be writing jQuery in SharePoint if there is a better solution…

jQuery is NOT the silver bullet in SharePoint, it is not the answer to every question, it is just another tool in the developers toolkit. I urge all developers to know what options exist out there and choose the right one! Sometimes it will be jQuery, sometimes it will be .NET,  sometimes it will be XSL, and sometimes it will be some other choice…

So, when is there a better solution to jQuery?

When you can’t get away from performance problems

Sometimes jQuery will just give you horrible performance regardless of what you do because of unavoidable obstacles. In these situations you are going to have to figure out an alternative. Can I do it with a DVWP or do I have to crack open Visual Studio?

When you need to do something that jQuery can’t do

There are lots of things you can’t do in jQuery like elevate privileges, event handlers, workflows, or interact with back end systems that have no web service interface. It just can’t do everything.

When it can be done faster and more efficiently another way

Why are you spending time to write jQuery to do a DataViewWebPart that would take 5 minutes? Or why are you trying to implement complicated logic that would be simple to do in .NET? If your answer is that you don’t have the option, okay. BUT if you do have the option don’t reinvent the wheel! Take advantage of the other tools.

The answer is not always jQuery… sorry… the kool-aid tastes good, but sweet tea is pretty awesome too.

You should not be using jQuery in SharePoint if you are a moron…

Let’s finish up the blog on a high note… Yes.. it’s true, I sometimes type things just to get a reaction… guess this section title might be a good example, but it feels good sometimes just to type the words that a lot of us think… So.. don’t be that guy!

Another good buddy of mine that works for Microsoft told me. “I loved jQuery in SharePoint…. until I had to support it.”. He went on to explain that some user was making several web service calls on a page using jQuery and then was calling Microsoft and COMPLAINING because the page took so long to load… DUH! What do you expect to happen when you are pushing that much data over the wire and are making that many web service calls at once!! It’s one thing to write that kind of code and accept it’s just going to take a while, it’s COMPLETELY another issue to do that and then complain when it’s not lightning fast!  Someone’s gene pool needs some chlorine.

So, I think this is a nice summary of the blog… DON’T be that guy… don’t be a moron. How can you stop yourself from being a moron? Ah.. glad you asked, here are some tips:


Is jQuery the right solution to my problem? Is there a better approach? What are the implications and pitfalls of using jQuery in this situation?


What are others doing? Does someone have a better solution? Is there a third party library that does the same thing I need?


Write good jQuery. Limit calculations and data sent over the wire and don’t reinvent the wheel when possible.


Okay, it works well on your machine. Try it on others ESPECIALLY if this is for an external site. Test with empty data. Test with hundreds of rows of data. Test as many scenarios as possible. Monitor those server resources to see the impact there as well.

Ask the experts

As smart as you are, there are people smarter than you. Even the experts talk to each other to make sure they aren't doing something stupid. And for the MOST part they are pretty nice guys. Marc Anderson and Christophe Humbert are two guys who regularly keep me in line. Make sure you aren’t doing something stupid.


So, when you think you have the best solution possible, repeat the steps above just to be safe.  Smile


jQuery is an awesome tool and has come in handy on many occasions. I’m even teaching a 1/2 day SharePoint & jQuery workshop at the upcoming SPTechCon in Boston if you want to berate me in person. However, it’s only as awesome as the developer behind the keyboard. It IS development and has its pitfalls. Knowledge and experience are invaluable to giving the user the best experience possible.  Let’s face it, in the end, no matter our opinions, prejudices, or ego providing our clients, customers, and users with the best solution possible is what counts. Period… end of sentence…