SPServices Stories #16: Beginning SharePoint Development with KoSp – Knockout for SharePoint, REST API and SPServices

Introduction

There were a few tweets from Ashok Raja today that caught my eye.

KoSpAshok has released a new Codeplex project called KoSp which helps with the bindings between SharePoint data and Knockout. Knockout has become a very popular library to use client side to manage data and Ashok’s tool should come in handy for anyone who decides to use it.

KoSp, Knockout for SharePoint 2013 and SharePoint 2010 is a knockout binder extensions for SharePoint REST API and SPServices. KoSp provides custom knockout binding handlers that enables easy binding of json data from SharePoint lists retrieved via REST API with oData queries and  SP Services with CAML queries with client side controls.

Now, I’ll admit that I haven’t had time to try this out. After all, Ashok just released it today. I did take a quick look through the JavaScript file, though, and it looks good.

Ashok’s posts give examples of how to use KoSp with both REST calls and SOAP calls using SPServices. Which you decide to use is really up to you and which version of SharePoint you’re using. If you’re on SharePoint 2007, SPServices is definitely the ticket, on SharePoint 2010 and 2013, you have a choice of REST or SOAP. What you choose should be determined by your requirements and your available skill sets.

I wanted to reproduce the “Beginning” post from Ashok’s blog here to help give him some publicity for his efforts on KoSp. I know how it can be frustrating to do great work, put it on Codeplex, and then just hear the crickets. Given that Ashok has just released the project, I’m sure he’d love to have some downloads, but even better, some feedback on how it works for others and what they would like to see next. If you’re interested in using Knockout with SharePoint, give it a look.

As with all of the posts written by others in the SPServices Stories series, I’ve done some minor editing and added a few notes, but otherwise, the content is all Ashok’s. Enjoy.

Beginning SharePoint development with KoSp – Knockout for SharePoint , REST API and SPServices

Follow the below steps to build your first KoSp-based SharePoint application. The first method explains the REST API mode and the next method explains the SPServices mode.

Method 1: Data via Rest API

Step 1

Download ko.sp.min.Ex.js, knockout.js, jquery.js from the respective project sites.

Step 2

Upload the downloaded JavaScript libraries to the Style Library of a SharePoint site.

imageStep 3

Create a new SharePoint List named “Employees” with columns Title (Default), Skills (Choice Field With Multi-select option with values “Asp.Net”, “C#”, “SharePoint”, “VB.Net”)

Step 4

Add some records to this list so that we can display those data in our application

Step 5

Create a new SharePoint page or edit an existing page. Add a script editor web part (located under Media and Content Category) to the page. [Or use a Content Editor Web Part pointing to a Content Link]

imageStep 6

Click the “EDIT SNIPPET” link of script editor web part and copy paste the below code into it (Change the site URL in the script paths pointing to your style library or where ever you have placed the code)

<script src="http://srv2:902/ko/Style Library/kosp/jquery-1.8.3.min.js"></script>
<script src="http://srv2:902/ko/Style Library/kosp/knockout-3.0.0beta.js"></script>
<script src="http://srv2:902/ko/Style Library/kosp/ko.sp-1.0.min.Ex.js"></script>

<div>
  <table width="600px">
    <thead>
      <tr>
        <th>Employee Name</th>
        <th>Skill Set</th>
        <th>Created Date</th>
        <th>Created By</th>
      </tr>
    </thead>
    <tbody data-bind="template: { name: 'Emp', foreach: Employees }" />
  </table>
</div>

<script type="text/html" id="Emp">
  <tr>
    <td data-bind="text:Title"></td>
    <td data-bind="spChoice:Skills,multi:true"></td>
    <td data-bind="spDate:Modified,dataFormat:'DD-MMM-YYYY, hh:mm:ss a'"></td>
    <td data-bind="spUser:ModifiedBy"></td>
  </tr>
</script>

<script type="text/javascript">

function EmployeeModal() {
  var self = this;
  self.Employees = ko.observableArray([]);
  $.getJSON(_spPageContextInfo.webAbsoluteUrl + "/_vti_bin/listdata.svc/Employees?$expand=Skills,ModifiedBy",
    function (data) {
      if (data.d.results) {
        self.Employees(ko.toJS(data.d.results));
    }
  });
}

$(document).ready(function () {
  ko.applyBindings(new EmployeeModal());
});
</script>

Check in and save the page.

That’s it. Now the data will be rendered in a tabular format as shown below.

imageWell, let’s see what’s there in the above code. If you notice the code, except for spDate, spUser and spChoice in the data-bind attribute, all the remaining code is related to typical Knockout view and View Modal. The data binding handlers starting with “sp” are related to KoSp and it takes care of parsing and formatting the data.

If the default text binder of Knockout is used instead of KoSp, the below would be the expected output.
image

Template code with default text binder
<script type="text/html" id="Emp">
  <tr>
    <td data-bind="text:Title"></td>
    <td data-bind="text:Skills"></td>
    <td data-bind="text:Modified"></td>
    <td data-bind="text:ModifiedBy"></td>
  </tr>
</script>

Note: Subsequent post explains in detail about each and every Knockout binding handlers available in KoSp

Method 2 : Data via SPServices

Step 1

Download SPServices from Codeplex along with all the JavaScript libraries mentioned in Step 1 of Method 1

Step 2

Follow steps from 2 to 6 in Method 1 and replace the code with the below code.

<script src="http://srv2:902/ko/Style Library/kosp/jquery-1.8.3.min.js"></script>
<script src="http://srv2:902/ko/Style Library/kosp/jquery.SPServices-2013.01.min.js"></script>
<script src="http://srv2:902/ko/Style Library/kosp/knockout-3.0.0beta.js"></script>
<script src="http://srv2:902/ko/Style Library/kosp/ko.sp-1.0.min.Ex.js"></script>

<div>
  <table width="600px">
    <thead>
      <tr>
        <th>Employee Name</th>
        <th>Skill Set</th>
        <th>Created Date</th>
        <th>Created By</th>
      </tr>
    </thead>
    <tbody data-bind="template: { name: 'Emp', foreach: Employees }" />
  </table>
</div>

<script type="text/html" id="Emp">
  <tr>
   <td data-bind="text:Title"></td>
   <td data-bind="spChoice:Skills,src:'sps'"></td>
   <td data-bind="spDate:Modified,src:'sps',dataFormat:'DD-MMM-YYYY, hh:mm:ss a'"></td>
   <td data-bind="spUser:ModifiedBy,src:'sps'"></td>
  </tr>
</script>

<script type="text/javascript">

function Employee(data) {

  this.Title = ko.observable(data.Title);
  this.Skills = ko.observable(data.Skills);
  this.Modified = ko.observable(data.Modified);
  this.ModifiedBy = ko.observable(data.ModifiedBy);

}

function EmployeeModal() {

  var self = this;
  self.Employees = ko.observableArray([]);

  $().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "Employees",
    CAMLViewFields: "<ViewFields Properties='True' />",
    CAMLQuery: "<Query></Query>",
    completefunc: function (xData, Status) {
      var spsData = $(xData.responseXML).SPFilterNode("z:row").SPXmlToJson({ includeAllAttrs: true, removeOws: true });
      if (spsData) {
        $.each(spsData, function (k, l) {
          self.Employees.push(new Employee({
            Title: l.Title,
            Skills: l.Skills,
            Modified: l.Modified,
            ModifiedBy: l.Editor
          }))
        });
      }
    }
  });
}

$(document).ready(function () {
  ko.applyBindings(new EmployeeModal());
});

</script>

[As I pointed out in a comment on Ashok’s post, note that as of SPServices 2013.01, you can use jQuery promises (.Deferred() objects) This eliminates the need to do synchronous calls and can really improve performance, especially in IE. See my blog post about Comparing SPServices 2013.01 Calls with Async vs. Promises Methods.]

Save and publish the page. You can expect the same output as shown in Step 6 of Method 1

If the default text binder of Knockout is used instead of KoSp, the below would be the output you can expect.

imageHope this might have provided you a clear understanding of how to begin with KoSp for SharePoint.

Knockout for SharePoint at Codeplex

‘Essential SharePoint 2013’ Now Available

Check out the latest edition of Essential SharePoint, this time for the 2013 version of SharePoint: Essential SharePoint® 2013: Practical Guidance for Meaningful Business Results (3rd Edition) (Addison-Wesley Microsoft Technology Series). It’s authored by my friends Scott Jamison (@sjam), Susan Hanley (@susanhanley), and Chris Bortlik (@cbortlik) and is jam (see what I did there?) packed with great content about SharePoint you won’t find anywhere else.

This book isn’t just for techies and isn’t just for business people. It’s based on the deep knowledge the authors have about what works and what doesn’t when it comes to implementing SharePoint in the enterprise. Anyone who reads it will learn a lot about how to succeed in their SharePoint journey.

If you haven’t made the journey to SharePoint 2013 yet, never fear. Equally great versions of this book exist for SharePoint 2010 and 2007.

I have a special fondness for the 2007 edition, but I can’t say why. Let’s just say that I’m more fond of Chapter 13 than all of the others.

For those of you into disclosures and such, yes I did receive a free copy of the 2013 edition, and no it didn’t impact my decision to write this post.

Bonus questions: What color will the next edition be? And when will it be published?

Thoughts on the Discontinuation of the Microsoft Masters Program by Microsoft Learning

I’m putting aside a fun post I’m working on about how my recent trip to Africa and seeing its wildlife on our safari relates to SharePoint to write this unfortunate post instead.

As most of you know, Microsoft sent an email to all of its MCMs/MCSMs/MCMAs (I cannot keep acronyms – nay, initializations – straight. If that’s not right, forgive me.) saying that their programs are to be put on hold starting 1 October, 2013. I didn’t get the email because I don’t hold any of the certifications. In fact, I don’t hold *any* certifications and have never seen any need to. However, I know how valuable and important the MCMs/MCSMs/MCMAs rotations are to the longevity of the products they teach because I know many of the people who hold those certifications for SharePoint.

While I didn’t get the email, it’s freely available on the Web at this point. I’m including it here in its entirety from Neil Johnson’s blog simply because I found it tough to track down, only seeing various snippets in others’ posts.

We are contacting you to let you know we are making a change to the Microsoft Certified Master, Microsoft Certified Solutions Master, and Microsoft Certified Architect certifications. As technology changes so do Microsoft certifications and as such, we are continuing to evolve the Microsoft certification program. Microsoft will no longer offer Masters and Architect level training rotations and will be retiring the Masters level certification exams as of October 1, 2013. The IT industry is changing rapidly and we will continue to evaluate the certification and training needs of the industry to determine if there’s a different certification needed for the pinnacle of our program.

As a Microsoft Certified Master, Microsoft Certified Solutions Master, or Microsoft Certified Architect, you have earned one of the highest certifications available through the Microsoft Certification program. Although individuals will no longer be able to earn these certifications, you will continue to hold the credential and you will not be required to recertify your credential in the future. You will continue to have access to the logos through the MCP site, and your certifications will continue to show in the appropriate section of your transcript, according to Microsoft technology retirement dates. If you are a Charter Member, you will continue to hold the Charter Member designation on your transcript.

Also as a Microsoft Certified Master, Microsoft Certified Solutions Master, or Microsoft Certified Architect, you are a member of an exclusive, highly technical community and you’ve told us this community is one of the biggest benefits of your certification. We encourage you to stay connected with your peers through the main community distribution lists. Although we won’t be adding more people to this community, you continue to be a valued member of it. Over time, Microsoft plans to transition the distribution lists to the community, and, with your consent, will include your information so that it can continue to be a valuable resource for your ongoing technical discussions.

Within the coming weeks, you will receive invitations to an updated community site. This community site will require you to sign in with a Microsoft Account and will replace the need for a Microsoft Partner account as is required today. From this site, you will be able to manage service requests for the Masters and Architects communities – such as ordering welcome kits and managing your contact information for the distribution lists and directory – and accessing training rotation and other community content (if applicable).

If you have not ordered your Welcome Kit, the last day to do so is October 31, 2013. To order your Welcome Kit, please contact the Advanced Cert team at advcert@microsoft.com.

We thank you for your commitment to Microsoft technologies.

So this may seem all well and good. Existing certification holders can “continue to hold the credential and you will not be required to recertify [their] credential in the future”. That’s good because those folks worked damn hard to reach the “pinnacle” they have achieved. Telling them that they couldn’t claim the certifications anymore would just be silly, right? Plus, they are going to get “an updated community site” to use, helping them all to “manage service requests for the Masters and Architects communities – such as ordering welcome kits and managing your contact information for the distribution lists and directory – and accessing training rotation and other community content”. Of course that content won’t be generated anymore based on the announcement, so I’m not sure what the benefit there is.

Over on the Microsoft Connect site (a site whose true purpose I do not actually know), a SQL Server MVP – Jen Stirrup – quickly started a petition called “Please don’t get rid of the MCM and MCA programs“. At this writing, the voting has it at 305 for and only 5 against. Obviously, it’s a self-selecting audience voting, so that ratio comes as no surprise.

However, if you read through the responses to the petition (very difficult to do if you choose to use a mobile device or by printing it, as the text is cut off down the right side), you’ll start to get a handle on the anger that this decision is engendering.

The email was sent at about 10pm EDT Friday night in the United States. For those of you outside the States, this weekend is our annual Labor Day holiday. In brief, Wikipedia describes our Labor Day as “a creation of the labor movement [that] is dedicated to the social and economic achievements of American workers”. It’s ironic that this is the time that the Microsoft Learning (MSL) folks decided to send out the email for several reasons. As with many holidays elsewhere, we have Monday off: it’s effectively what a “bank holiday” is in the UK and elsewhere. Because of this, many people really try hard to disconnect from work and their email until Tuesday. Because of this, one can extrapolate that the email was sent when it was to stretch out the awareness of it and marginalize any backlash. Also, since it’s a holiday “dedicated to the social and economic achievements of American workers”, it’s meant to celebrate the type of achievements that the MCM/MCSM/MCMA folks have attained.

Tim Sneath, who is a Senior Director muckety-muck at MSL (based on my LinkedIn sleuthing) responded to the comments in the discussion on the petition on Saturday afternoon. Here are his comments in their entirety, again because there’s a lot there and it can be tricky to parse it all out.

Posted by Tim Sneath on 8/31/2013 at 1:32 PM

Thank you for the passion and feedback. We’re reading your comments and take them seriously, and as the person ultimately responsible for the decision to retire the Masters program in its current form, I wanted to provide a little additional context.

Firstly, you should know that while I’ve been accused of many things in my career, I’m not a “bean counter”. I come from the community myself; I co-authored a book on SQL Server development, I have been certified myself for nearly twenty years, I’ve architected and implemented several large Microsoft technology deployments, my major was in computer science. I’m a developer first, a manager second.

Deciding to retire exams for the Masters program was a painful decision – one we did not make lightly or without many months of deliberation. You are the vanguard of the community. You have the most advanced skills and have demonstrated it through a grueling and intensive program. The certification is a clear marker of experience, knowledge and practical skills. In short, having the Masters credential is a huge accomplishment and nobody can take that away from the community. And of course, we’re not removing the credential itself, even though it’s true that we’re closing the program to new entrants at this time.

The truth is, for as successful as the program is for those who are in it, it reaches only a tiny proportion of the overall community. Only a few hundred people have attained the certification in the last few years, far fewer than we would have hoped. We wanted to create a certification that many would aspire to and that would be the ultimate peak of the Microsoft Certified program, but with only ~0.08% of all MCSE-certified individuals being in the program across all programs, it just hasn’t gained the traction we hoped for.

Sure, it loses us money (and not a small amount), but that’s not the point. We simply think we could do much more for the broader community at this level – that we could create something for many more to aspire to. We want it to be an elite community, certainly. But some of the non-technical barriers to entry run the risk of making it elitist for non-technical reasons. Having a program that costs candidates nearly $20,000 creates a non-technical barrier to entry. Having a program that is English-only and only offered in the USA creates a non-technical barrier to entry. Across all products, the Masters program certifies just a couple of hundred people each year, and yet the costs of running this program make it impossible to scale out any further. And many of the certifications currently offered are outdated – for example, SQL Server 2008 – yet we just can’t afford to fully update them.

That’s why we’re taking a pause from offering this program, and looking to see if there’s a better way to create a pinnacle, WITHOUT losing the technical rigor. We have some plans already, but it’s a little too early to share them at this stage. Over the next couple of months, we’d like to talk to many of you to help us evaluate our certifications and build something that will endure and be sustainable for many years to come.

We hate having to do this – causing upset amongst our most treasured community is far from ideal. But sometimes in order to build, you have to create space for new foundations. I personally have the highest respect for this community. I joined the learning team because I wanted to grow the impact and credibility of our certification programs. I know this decision hurts. Perhaps you think it is wrong-headed, but I wanted to at least explain some of the rationale. It comes from the desire to further invest in the IT Pro community, rather than the converse. It comes from the desire to align our programs with market demand, and to scale them in such a way that the market demand itself grows. It comes from the desire to be able to offer more benefits, not fewer. And over time I hope we’ll be able to demonstrate the positive sides of the changes we are going through as we plan a bright future for our certifications.

Thank you for listening… we appreciate you more than you know.

Tim Sneath

tims@microsoft.com

From this we get that while the program “loses [Microsoft] money (and not a small amount)”, “that’s not the point”. Yet Tim goes on to say that “the costs of running this program make it impossible to scale out any further”. In other words, it’s about the money. This from a company that has at least $50 billion in the bank, “yet we just can’t afford to fully update” the programs. Tim also says that “with only ~0.08% of all MCSE-certified individuals being in the program across all programs, it just hasn’t gained the traction we hoped for”. This is the program that Tim describes as being aimed at the “ultimate peak of the Microsoft Certified program”. In my view, that .08% number is not at all worrisome. I don’t know what the denominator is, but as far as I know, there aren’t more than a few hundred MCMs/MCSMs/MCMAs globally. To me, that’s the very definition of a “peak” or “pinnacle”. Turning to Dictionary.com, we find that a pinnacle is “the highest or culminating point, as of success, power, fame, etc.: the pinnacle of one’s career” and a peak is “the highest or most important point or level” or “the maximum point, degree, or volume of anything”. Just as in grade school here in the US when we took those achievement tests, less than one-tenth of one percent – .1% – were able to reach the top level. That number is about right; the program is hard. Very hard.

The fact that only .08% of all MCSE-certified individuals have achieved the MCM/MCSM/MCMA certifications is a Very Good Thing. Everyone knows that the lower level certifications are no sure indicator of actual skill level. You are as likely to get a highly accomplished, MCSE-certified individual as you are to get a dud. There simply are too many people managing to get those certifications, however they do it. There is zero question in anyone’s mind about the abilities of the MCM/MCSM/MCMA folks. They go through a program that has such rigor that it exhausts them. Some people don’t make it, nor should they. If they can’t do it, then they aren’t masters.

As Mary Jo Foley has pointed out in her article on ZD Net about all this, there may be some sort of “hope”, since Tim says that MSL is simply “taking a pause” and “looking for ways to create a new ‘pinnacle’ certification program”. Well and good, but there are people in the middle of preparing for or taking the certification exams who are left high and dry after expending huge amounts of personal effort and undoubtedly large amounts of funds already. Those investments will fall by the wayside, including such seemingly inane things as non-refundable plane tickets worth thousands of dollars for people to travel to Redmond for the rotations and exams.

So, why should I even care? Why should I be spending Sunday afternoon on a holiday weekend writing this post? I’m not now – nor have I ever been – in the programs at question. Spencer Harbar (@harbars) – never a shrinking violet – put down most of his often caustic style to make some great points in the petition thread. Again, in full.

Posted by Spencer Harbar [MCA, MCSM] on 9/1/2013 at 10:45 AM

@Tim.

Leaving aside the actual decision and its merits or otherwise for a moment. Surely you must recognise that the manner of your organisation’s communications this weekend would be met with such anger? And cause Microsoft much (further) embarrassment.

Why did you let it happen this way? Why did you not step in and stop the impending disaster created by such an ill-informed, arrogant and downright unprofessional message to your best customers? None of us would ever treat our customers in this manner, it isn’t acceptable from you either.
You state that you come from the community. Indeed, as you are aware many of know you from way back – either personally, thru Microsoft, or following your blog along with your move from the UK. If you are really a developer first and understood *this* community, the email message your organisation sent to all of us never would have been allowed.

You have years of experience in this space, but yet, the contents of the message were approved, and here we are – dealing with the fallout from something that could have so easily be prevented if you had actually engaged the community, rather than professionally insulting it.
I guess I am prepared to give you the benefit of the doubt at this point… but a lot depends on how you react going forward, especially to the contents of this message.

Your remarks below categorically demonstrate in a multitude of ways something that most of are acutely aware of already. That actually MSL leadership does NOT understand these programs, why they exist(ed) and their relationship with Microsoft’s strategic objectives, the state of field readiness for the products and workloads they address, and customer requirements. You talk to a bunch of good stuff about a new “pinnacle” and doing so in line with MSL’s market demand. That’s all very well and good, and I wish you all the best with that, but that’s not, nor ever will be what the MCM/A is about. Therein of course lies the nub of the greater problem of course – and I’m sure a topic of much debate going forward.

You must learn to understand that the MCM/As are not a bunch of “IT Pros” with some certs. And I mean *really understand*, not claim you understand and expect us to believe you. We are the leaders in the marketplace, but yet you send us an obtuse message late on a Friday evening on the Labor Day weekend? And you sign off that message with “Respectfully” despite its contents representing a clear and direct professional insult to the recipient and in many cases their employers.

If you really did have the “highest respect” for this community, as you claim, then you would have ensured this decision was messaged correctly and handled in a professional and considered fashion. Furthermore you wouldn’t be labelling us “IT Pros” – wow! Do you have any concept just how ridiculous that term is to describe the people in this community?

I for one, after investing five years of my professional life in this program, are waiting for you to issue a strong public apology for the manner of MSL’s recent actions. Without such an apology, I find it hard to see why we would possibly be interested in helping you in the future “evaluate your plans”.

You claim that you have spent many months deliberating and that “it wasn’t easy”. I’m sorry – it just doesn’t wash. Not one bit. Did you really mean to say that in a message that you knew I would see? You have never, not once spoke to us about any of this. MSL were at TechEd selling rotations and exams recently. If you spent months on it, how come you couldn’t spend the 10 minutes necessary to step back and realise that not having your story straight and sending a blunt little “up yours” to all of us would be a disaster? The “context” of the decision is irrelevant to the main reason why everyone is so angry at you and Microsoft this weekend.

Please, if you respect us, make an argument with credibility. We are the people that “no matter what the problem, everything will be OK” – the regular Microsoft defensive soft soap and lip service will be seen through in a New York nanosecond. Again, if you respect us, then don’t play us for fools.

Without an apology for the nature of the way this decision was communicated, I don’t see how you can expect any goodwill from the majority of this community going forward.

Respectfully

The guy that just lost his job because of your actions

As Spence is clear to point out, he has a vested interest in the program; he’s been teaching it for over five years (maybe since it started?). However, Spence points out at least one of my biggest beefs. Microsoft seems to have lost the ability to communicate with it’s most ardent supporters in any sort of cogent or effective way. As I said yesterday on Twitter in a bit of pique:

9-1-2013 4-29-43 PM

The people in these elite programs stand by Microsoft in many cases where Microsoft doesn’t even deserve it. They make the products work when no one else can – they are *far* better then anyone in Microsoft Support will ever be. To be told that they are losing some of the meaning in perhaps one of their most significant professional achievements via a poorly thought out email over a holiday weekend is simply ludicrous. It has quite a few of them suggesting they should go and work for Oracle or take up other technologies now. I’m am absolutely certain that this is not MSL’s goal.

Not only is the email a slap to those who have the certifications, it amounts to a firing-by-email to Spence and the other instructors. They heard about the demise of the program at the same time. Again, this can hardly be what MSL wants to be doing to some of their most talented and passionate supporters and instructors.

Now, an apology would be nice, and a reversal would probably appease some people. What I find so galling about all of this is the utter lack of connection Microsoft has with most of us out here. I believe that this shows in their products, their award programs, their market share, really everything.

As an MVP, I see this in almost every interaction I have with people at Microsoft. I’m awarded something nebulous in a program that is ill-defined and oddly run. I’m told I’m getting all sorts of inside information, and that comes primarily from people in Marketing roles, so I have no idea if it means anything at all. I’m told that I cannot say anything remotely critical of anything the SharePoint Product Group does because it might upset them. (I have saved those emails, believe me.)

The general vibe from Redmond has changed from something fairly positive and become “we know best, you don’t get it, and we don’t really care what you think”. I do have data points to back this up, as my interaction with people in Redmond started back in 1999. At that point, I was younger and more naïve, but the general feeling about ‘Softies was that they were extremely bright and that they could listen to the marketplace. Their products were good, if not perfect, and they strove to improve them. They let us know what was coming up; not far into the future, but we got some good info so that we could plan ahead.

Nowadays, everything is a secret until it breaks something, then it is what they meant to do, and it must be our fault. Products like Windows 8 and the SharePoint 2013 app model are an enigma. People at Microsoft are actively working against each other due to their venomous stack ranking evaluation practices.

With this ill-conceived, poorly communicated, odd decision about the Masters program, it just feels like more of the same. Many of us are losing faith in the very company that helps us feed our families and support our lifestyle due to that company’s own – often inept – actions.

There are a lot of “real” reasons floating around about why the program is really being stopped. It’s too expensive, it’s too elitist, no one understands it, it’s all about the cloud. Given what I know of Microsoft, we’ll never know the real reason. To me, what’s more important than the “what” or “why” here, though, is the “how”.

This is yet another slap in the face to some of Microsoft’s biggest fans. That’s just plain dumb.

Other Opinions

MCM certs gone: Microsoft’s “cloud” reality distortion field in full force by Jeremy Thake (@jthake)

Microsoft Advanced Certification (MCA, MCSM, MCM) – the end of an era by Wictor Wilen (@wictor)

The fall of the Master by Radi Atanassov (@RadiAtanassov)

Retiring the MCM/MCSM/MCA Certifications – Thoughts On Why Microsoft Would Do This by Seb Matthews (@sebmatthews)

Death of an MCM by Chris Givens (@givenscj)

Are Microsoft Losing Friends and Alienating IT Pros? by Steve Goodman (@stevegoodman)

Collaboration is About Behavior, Not Software

Supriyo B “SB” Chatterjee (@sbc111) shared an excellent article on SPYam last night from Adi Gaskell’s (@adigaskell) blog.

In the article, Adi says:

If only it was that simple. The reality is often very different however. The reality is often that most organisations are not collaborative at the moment. Employee behaviour has been ingrained through years of reinforcement, that salary and promotion are intrinsically linked to individual performance.

Changing behaviours at work requires changing the environment that surrounds people when they’re at work.

Image from Adi’s post

Big thumbs up on this one. Collaboration is a result of a culture that encourages it; culture is a sum of the individuals in the group. Most organizations tie their incentives to things that actually discourage collaboration (stack ranking, anyone?). We can implement every system in the world and people who aren’t encouraged to collaborate, won’t. This is one of SharePoint’s dirty secrets: it can’t solve anything that people don’t truly want to solve.

One of my biggest beefs with most SharePoint installations is the strong desire for workflows. We don’t do workflows for ourselves (generally), we do them *to* others. Collaboration isn’t something we force; it must be a natural step in the work process. By putting too much rigor around work, we end up discouraging collaboration. We’ve removed the back currents and eddies in the flow where serendipitous collaboration can occur. Note: I have no beef with workflows for highly repetitive, non- value add tasks, like submitting expense receipts or approving a document. If there’s any room there for collaboration, please tell me about it.

This is nothing new. The knowledge management movement in the mid-nineties suffered from similar constraints. We’re still outgrowing the command-and-control structures that were so successful in the 1950s. Those militaristic management styles work pretty well in manufacturing or assembly work, where consistent unit production is the goal. With knowledge work, there are many intangible work products like effective meetings, project management (not project measurement, which is often the tacit goal), or effective content generation.

So if you or anyone you know think that installing some software will change your company’s ability to collaborate, think again. It’s going to be a very long haul for you with a lot of wasted time and money unless you focus on the underlying incentives and motivations at the same time – or even ahead of time. That starts with the people at the top and trickles right on down. “Thou shalt collaborate” is a death knell for the very goal it espouses. “Let’s talk about how we can encourage collaboration” is oh-so-much better.

<UPDATE date=”2013-09-03″>

Pankaj Taneja wrote another take on this in his post The 3 Pillars of Collaboration, which I culled from the comments on Adi’s post.

To me, policies are good as fall backs in case of issues and can set the tone for how collaboration might work, but too many constraints quash collaboration.

I would disagree that “[a]mbiguity is the greatest enemy of collaboration”. Ambiguity is a given in life. Collaboration happens where and when it makes sense, as long as we don’t prevent it. That prevention can come from the way we implement technologies or structure incentives, but it can also be caused by an abundance of policy. A certain amount of undefined leeway is crucial to good collaboration, and that requires trust, not rules.

</UPDATE>

SPServices Stories #15: Custom Client-side Calendar Query for Office 365 SharePoint Site Using SPServices jQuery Library

Introduction

My friend and fellow MVP Becky Bertram (@beckybertram) recently acquiesced to my suggestion to try using SPServices to solve a challenge she had in rolling up calendar items across lists. I know it may often seem that since SPServices is my hammer that I always say to whack the nails with it, but sometimes it’s actually a good suggestion!

Becky wrote up a nice overview of her approach on her blog. It’s always interesting to see the differences in how people use SPServices. Becky built herself some great functions, which allows for better reuse over time. It amazes me sometimes how others end up with hundreds and hundreds of lines of code rather than coming up with generalized functions, as Becky does here. Sure, some SPServices users aren’t “developers”, but that doesn’t mean that they can’t learn from the examples and build stronger code for it.

Note that the REST services also let you access calendar items (or any other list items), but CAML gives you a better syntax to use with recurring events than I’m aware of in the REST interface. Yup, sometimes, I prefer CAML over the newer stuff.

Check out Becky’s blog for lots of other great SharePoint tips and tricks, too!

Custom Client-side Calendar Query for Office 365 SharePoint Site Using SPServices jQuery Library

I’m building an Office 365/SharePoint Online intranet site for a client and they wanted to show a list of the current day’s events from various calendars on the site, in a format like this:

8:30​ a.m. ​Staff Meeting ​Room 103
​10:00 a.m. Training ​Cafeteria
​3:30 p.m. Retirement Party ​Conference Room

As you might know, you can’t use a normal CAML query to retrieve calendar entries if you want to retrieve reoccurring events that happen within a given timeframe. (If the first instance of a reoccurring event happened outside the timeframe you queried, the event would not be retrieved, even if it had reoccurring events that happened during the queried timeframe.) The Content Query Web Part will not do the trick.

On projects past, I’ve simply created a web part with a custom CAML query that utilizes the DateRangesOverlap node, and installed that web part using a solution package. This being Office 365, that’s not an option. I could have created a sandbox solution containing the web part but that’s also not a preferred approach since Microsoft seems to be deprecating sandbox solutions. At the urging of Marc Anderson, I tried using his SPServices library.

The SPServices library is a jQuery library that accesses SharePoint web services. By attaching your library to a particular Office 365 SharePoint URL, you can retrieve list items using the SharePoint web service, then use them with jQuery. There’s a discussion thread [on the SPServices Codeplex site – lots of other great stuff there, too!] about how to use SPServices to retrieve calendar entries. I decided to modify the file provided in that thread and use it. The main modification I needed was the ability to combine calendar entries from more than one calendar and show them in a common calendar. This meant utilizing a sorting function after entries from multiple calendars were retrieved so all entries would be listed in the proper order.

You can download my calendar.js file here.

Once I had added the script to my site, I added the following lines of code to my page layout in the header:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.3/jquery-ui.min.js" type="text/javascript"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/0.7.2/jquery.SPServices-0.7.2.min.js"></script>
<script language="javascript" src="/Style Library/Scripts/calendar.js" type="text/javascript"></script>

<script type="text/javascript">
$(document).ready(function (){
  CallSPServicesCalendar("https://[sitename].com/site1", "Calendar 1");
  CallSPServicesCalendar"https://[sitename].com/site2", "Calendar 2");
  $('div.calendarItem').sortElements(sortByDate);
  if ($('div.calendarItem').length == 0) {
   $("#calendarData").append("There are no events scheduled for today.");
  }
 });
</script>

The script block at the bottom passes in the URL of the web being queried as a first parameter, and then the name of the calendar list as a second parameter. CallSPServicesCalendar is the name of my function in calendar.js that retrieves calendar entries. At the bottom of my calendar.js I have a function that sorts the calendar entries, which you can see is being called with .sortElements in the script above. If no list items are retrieved, a message is displayed saying there are no events. If you want to query more calendars, simply add new calls to the CallSPServicesCalendar function.

In the calendar.js file you’ll notice a section with Field nodes that get passed into the CAML query. You can modify this section to add your own fields if you have custom fields you want to retrieve and display.

In the body of the page, I added a div tag like this, and this is where the event information was added in the page:

<div id="calendarData"></div>

In the calendar.js file, you can modify the HTML that gets rendered for each calendar entry.