Announcing DP_SharePoint

SharePoint LogoI’ve published the initial version of my JavaScript library, DP_SharePoint, designed to make working with client-side SharePoint development easier.  Still in development, the library provides:

  • Methods to acquire JavaScript handlers to SharePoint form controls and fields. This make it much simpler to interrogate or add event handlers to SharePoint forms.
  • Simple methods to add or remove events from SharePoint form elements.
  • Simple methods to hide and show elements of SharePoint forms.
  • Methods to simplify the calling and use of SharePoint web services and ready the data returned from them for use.

The library should be considered (very) beta but I am using it in a heavily trafficked production development.  I’ve got lots of plans for this, as I’m in a position to do a lot of SharePoint development over the next few months or years (all without access to SharePoint Designer or any back-end support).

Comments, criticisms or suggestions are always welcome!

I’ve GitHubbed! GitHubbled? GitHubliered?

I’ve finally gotten with the times and moved my JavaScript libraries and utilities to GitHub.  You can find me at My components are old (and, if I must admit it, old-fashioned) and I had never really considered them much beyond my own needs but since it seems a few other have found some of them useful I decided it was time become a little more formal.

The following components have been moved – feel free to fork ’em!

I’ll be maintaining the documentation here at, for now at least, and the examples will still be hosted at Comcast (as I’ve found no other viable options).  I’m open to any other suggestions to make working with my stuff easier.

Personal Archaeology: Using a GIF as a Data Pipe

Way back in the history-times, in August of the year 2000, I authored an article detailing a technique that allowed for bi-directional communication between a server and a web browser without a page refresh.  The technique was, if I do say so myself, pretty clever in a primitive, kludgy, clunky kind of way.  I have no idea if I was really the “first” to come up with this but I do know that the rise of standardized AJAX a few short years later completely and deservedly eclipsed it.

Using a GIF as a Data Pipe

What I’ve recently realized is that a lot of traffic still points to that article.  I, in fact, get nearly as many 404 errors for people looking for this article as I do legitimate hits to the site (“popular” I am not).  It’s listed in the Wikipedia article on Remote Scripting and in many blogs, forums and resource sites.  For the curious various versions of it are available on the Internet Archive.

Now it’s nothing more than a weird little historical artifact that I’ll keep here on the digital mantle for posterity.

DP_DateExtensions vs Excel: Fight!

I recently received a request for assistance with my JavaScript date extensions, DP_DateExtensions.  In part it says:

I need to simulate the MS Excel networkdays() function.  Excel would count 10th Jan 2013 midnight to 15th Jan 2013 midnight as 4 working days (6 days in total) but DP_DateExtension.js does not count the 10th so outputs 3 working days (5 total).

The Excel NetworkDays() function returns “business days” (removing Saturday and Sunday and optionally holidays from the calculation). In this case passing the function January 10th (a Thursday) to January 15 (a Tuesday) results in “4”.  This makes it clear that Excel is doing this calculation inclusively by date and obviously not from “midnight to midnight”.

Read more of this post

Update of DP_DateExtensions to add First-Day-of-Week Option

A slight update to my JavaScript date extensions, DP_DateExtensions, is now available for download.  This release adds the ability to specify which day of week is considered the first day of the week when using the date math functions.  (Thanks to Neil Cresswell of for suggesting this addition.)

JavaScript itself considers Sunday (denoted as zero) the first day of the week by default.  This update provides access to a new property of the Date object, Date.FirstDayOfWeek, that can be set to any day from Sunday (zero) to Saturday (six).  This setting will then affect date math in the  round(), ceil(), floor() and diff() functions when the specified date part is “weeks”.

     // Set first day of week to Monday ("1")
Date.FirstDayOfWeek = 1
     // Create a new date
CurDate = new Date();
     // Perform some date math
RoundedWeek = CurDate.round("weeks");
FloorWeek = CurDate.floor("weeks")
CeilWeek = CurDate.ceil("weeks")

Personally I’ve not needed to leverage this yet, but I can definitely see it coming in handy.

Adding Events to SharePoint Fields

SharePoint Logo[This article should be considered deprecated.  The code represented has been improved, extended and made available as the DP_SharePoint Function Library.  All future effort will be applied there.]

The first article in this series dealt with obtaining a reference to a SharePoint field in Add and Edit forms.  One of the most common reasons to head down this path is to add custom validation to fields.  Often this requires adding events to (in the case of most fields) the onchange or (in the case of buttons) the onclick events of the fields.  Simply setting the event handler directly would work, but will eliminate any currently enabled handlers (such as those defined internally to SharePoint).

Instead I created two functions to abstract the standardized addEventListener() and (for older IE browsers) the attachEvent() methods.  They accept a reference to an HTML element (in this case a SharePoint form field), an event type and a function name to call when the event is fired.  The first adds an event to the passed element and the second (which is included for balance but which I’ve honestly never actually used) removes it.

Read more of this post

Obtaining a JavaScript Reference to a SharePoint Field

SharePoint Logo[This article should be considered deprecated.  The code represented has been improved, extended and made available as the DP_SharePoint Function Library.  All future effort will be applied there.]

I’ve been digging further and further into the bowels of SharePoint.  It’s not a pleasant place to dig.  At my company end-users and team-site owners are prohibited from doing any back-end development.  Additionally, due to various political issues, there are currently no available processes to contract for such work (although you can be added to an ever-growing waiting list).  The only development path open to site owners is client-side JavaScript.

On the team-site I manage one of the most used features is a custom list cataloging enterprise Incidents managed by the team.  Each incident is logged with information about the applications affected, the team engagement times and many other pieces of information.  The list feeds business customer reports and generates performance metrics for upper management.  With over 20 people on the team the quality of information can be rather shaky.  It would benefit greatly from some simple validation and a few points of automation.

Read more of this post