SharePoint 2007 Auto Page Refresh on Workflow Completion (SOLVED)

Posted in javascript, SharePoint, web development, xhtml with tags , , , , on December 9, 2011 by drew

Well, solved with some JavaScript that is.

This won’t be the ideal situation for everyone, but works for my immediate need and may well work for yours.  Use with caution!

The Problem:

Often in the SharePoint world we use a Workflow designed and deployed with SharePoint Designer to update a list field value.  Usually this is down when we want to include information from another list or something similar.

In my scenario, I was tasked with creating a simple Email Register that displayed a link with embedded subject and CC.  The subject needed an auto number included. The MSDN forums had the SharePoint auto number solution.

Once this was implemented I was on my way! Well, almost. Nasty SharePoint didn’t show the generated email link until AFTER the user refreshed the page (F5).

The Solution:

jQuery! (Really, where you expecting something else?)

Using the code below, I’ve setup an auto page refresh. Now, we do have some caveats:

  • List must be sorted so Newest item is always at the top.
  • Users must NOT be allowed to change that.
  • If the site is slow, the page may perform 2-3 (or more if really slow) automated page refreshes.
  • Test and act in kind.
  • The WorkFlow column must be visible

So that being said, the JavaScript.

Include a Content Editor WebPart on the page, use the Source Editor to paste in the code. NOTE: you will have to adjust the column (td:nth-child(3)) to match what you have in your list.

Basically, the script just checks for “In Progess” in the WorkFlow column, waits for 1 second and refreshes the page. The 1 second pause helps reduce multiple refreshes.

About the Selector:

.ms-listviewtable: I used a class as the ID was crazy long and gave me some issues. If you have more then one of these on your page, beware it will check all of them.

tr:nth-child(2): Move to the 2nd row. The 1st row is the Header (column titles).

td:nth-child(3): Move to the 3rd Column. (You will probably need to adjust this) This column will have a header value of the WorkFlow name.

a span: The text is wrapped in an anchor and span tag.

The Script:

<script type="text/javascript" src=""></script>

<script type="text/javascript">
      var td = $(".ms-listviewtable tr:nth-child(2) td:nth-child(3) a span").html();
      if(td=="In Progress"){
function sleep(ms)
      var dt = new Date();
      dt.setTime(dt.getTime() + ms);
      while (new Date().getTime() < dt.getTime());

And this does nicely for my needs. Hope it helps someone!

.htaccess mime type for .jar .jad .cod files for over-the-air Blackberry installs

Posted in Blackberry, Java with tags , , , , , , on September 29, 2011 by drew

This is mostly self documentation.  If you find this useful then great!

To install a Blackberry app over-the-air you will need these mime types in your .htaccess file.  Or if you are using IIS you will need to use the IIS Management snapin to add them.

AddType text/ jad
AddType application/java-archive jar
AddType application/vnd.rim.cod cod

And, upload the “deliverables\Web\X.0.0″ files not the “deliverables\Standard\X.0.0″ files.  Not sure why/how/what but I kept getting the dreaded 907 invalid cod error message otherwise.


Empire Avenue: Just another Social Network?

Posted in Social Media with tags , , on June 20, 2011 by drew

First off, I’d like to make a response to a premise I wrote about a few months ago: Set it and leave it on Empire Avenue.

No, You cannot just “set it and leave it”. Empire Avenue has made the on-site interaction a large part of the “scoring” that my original premise didn’t quite work. In a sense you can just leave it. But your score will suffer from the neglect. I doubled my score when I got serious with it.

Ok, now for my next premise!!! <drum roll please>

Is Empire Avenue just another social network?

Hmm? is it? A lot of people quote the hype of how they are connecting and defining new relationships and partnerships and Empire Avenue is different from the rest.

Time will tell.

Every social network was IT when it first arrived. Empire Avenue could be just another one of those. There is just one variable, in my humble opinion, that can set Empire Avenue apart from the rest for a long time to come: Empire Avenue consumes other networks.

I think this is the key that will keep people coming back to Empire Avenue. No matter how many other Social Networks emerge, people will invariably come back to the Avenue to see how their interactions rank against others. Only if the great folks at Empire Avenue can keep up the relevancy of how they score social networks can they keep ahead of the others.

And that is all for now.

ASP.NET CodeFile versus CodeBehind

Posted in asp, web development with tags , , on April 18, 2011 by drew

1 up for the guys at Microsoft. They thought of every eventuality it seems.

I was stumped for a while on a weird error:

2011-04-18 10:52:34,416 [11] ERROR 4/18/2011 10:52:34 AM Error occurred: System.Web.HttpException (0×80004005): The file Page.aspx.vb does not exist.
at System.Web.UI.Util.CheckVirtualFileExists(VirtualPath virtualPath)
at System.Web.UI.TemplateParser.ProcessCodeFile(VirtualPath codeFileVirtualPath)
at System.Web.UI.TemplateParser.ProcessMainDirectiveAttribute(String deviceName, String name, String value, IDictionary parseData)
2011-04-18 10:52:34,416 [11] ERROR 4/18/2011 10:52:34 AM Stack Trace: at System.Web.UI.Util.CheckVirtualFileExists(VirtualPath virtualPath)
at System.Web.UI.TemplateParser.ProcessCodeFile(VirtualPath codeFileVirtualPath)
at System.Web.UI.TemplateParser.ProcessMainDirectiveAttribute(String deviceName, String name, String value, IDictionary parseData)

What was odd was that I was using a compiled, updateable application. Why on earth was it trying to reference the code behind when everything is dumped into a .dll file?

Turns out we have the CodeBehind and CodeFile attributes of the @Page directive… Nice one Microsoft! So even though the rest of the application runs from the dll I can change one page to still run from an un-compiled .vb file by changing CodeBehind to CodeFile!!

Hope this helps someone else who inherits a project with that directive changed on only one page.


Force complete user sign-out in SharePoint 2010 using SharePoint Designer

Posted in javascript, jquery, SharePoint, web development with tags , , , , on January 27, 2011 by drew

I came across a common situation today where users are not completely signed out.  To recreate the issue, Log into a SharePoint site, open at least one more tab, sign out, then click back or re-navigate to the site.  You won’t have to type your credentials to browse the site.

Thanks to this Microsoft forum post by, we can use some JavaScript to ensure the user is completely Logged Out.

My problem, is I have a hosted SharePoint installation so I can’t modify the “_layouts/signout.aspx” page.

So here we are:

  • Fire up SharePoint Designer.
  • Edit the v4.master Master Page.
  • Add the following jQuery CDN link to the bottom of the <head> tag.
    <script type="text/javascript" src=''></script>
  • Add the following line of JavaScript
  • Under the Site Pages, Create a new aspx page called logout.aspx and style it like the original signout.aspx or create your own style.
  • Add the following code:
    function _spBodyOnLoad()
     catch (e) { }
  • And your ready to go!

Of course, your installation may or may not be slightly different, etc, etc so adjust IDs accordingly if needed.


ASP.NET MVC 2.0 Routing – First Experimentation

Posted in web development on September 19, 2010 by drew

I’ve done file -> new on a few ASP.NET MVC 2.0 projects now, but nothing in earnest yet.  Nothing that I would eventually publish to the interweb.

Until yesterday.

I’ve finally decided to build my first Web 2.0 application built on ASP.NET MVC 2.0.  Complete with accessible forms, Pretty looks, Awesome AJAX that falls back gracefully, etc, etc, etc.

This site will probably be the death of me.  I’m counting the days until I get hate mail and death threats. The site: Online Bible Queries with social commenting on passages.  Yup, I’m going to let people discuss, live, the most controversial book ever.  The one book that consistently finishes as the #1 best seller ever year.

So, before I got into the project 3 hours I was writing routes.  Of course, the first basic route was there:

"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new {
controller = "Home",
action = "Index",
id = UrlParameter.Optional
} // Parameter defaults

Great, but that didn’t help me with a Version – Book – Chapter – Verse scenario. Did it?

So, I soon ended up with this:

new {
controller = "Search",
action = "Index",
Version = "King James",
Book = "Genesis",
Chapter = UrlParameter.Optional,
Verse = UrlParameter.Optional
} //defaults

Worked ok, but failed when the url was missing the Chapter and verse.
Moving it above the default route worked, but then it matched EVERYTHING including the /Home/Index, etc.

Making it less greedy did the trick.  I’ve read alot about not using greedy routes but I didn’t quite get it until I tried it. Go figure.

routes.MapRoute( //Route for AJAX that returns JSON Result
new {
controller = "Search",
action = "Query"

 routes.MapRoute( // Route for normal web browsing
new {
controller = "Search",
action = "Index",
Version = "King James",
Book = "Genesis",
Chapter = UrlParameter.Optional,
Verse = UrlParameter.Optional
} //defaults

Playing with the routes really helps understand the concepts of not just MVC Routing, but MVC in general.

I’m sure I’ll be working on these routes more in the future and no doubt they can be re-factored even more.

A unique twist in the social networking landscape

Posted in web development with tags , , , , on September 2, 2010 by drew

John Gushue recently wrote about the up and coming social networking site

I must say I agree with pretty much everything John has to say, including his initial reaction and expectations. There is one I’d like to add:

The basic premise of Empire Avenue isn’t predicated entirely with spending time on, but rather how much time you spend on other sites, like Facebook, Flickr, twitter and others sure to come.  While John stated this fact, I think it bears more thought.

Most, if not all, social networking sites require you to spend time on them.  Facebook is probably one of the biggest time wasters.  Twitter not so much.

EmpireAvenue simply rates your participation on other sites.  I’m sure there are those who spend precious little time on EA and still have a climbing “share” price.

Personally, I think this will be the factor that determines the success of EA.  I can ignore it for a month but still have people investing in me if I keep my active status in other sites.

So, what do you think?

Is Empire Avenue any different from other social networking sites or just the next fad site in a long list?


Get every new post delivered to your Inbox.