SharePoint Workflow and when to use it…

When building SharePoint workflow solutions you need to be very careful in only using it for small, single document-centric processes, and you need to try to avoid the ‘pain points’. For processes that push the boundaries of what workflow can do, you should consider redesign of the solution to reduce the workflow element or alternative products.

In a collaboration and publishing system like SharePoint, some sort of support for standard business process is essential. SharePoint workflow supports that for simple processes, but it is not enterprise grade workflow (yet). Indeed, out of the box it doesn’t work (at least, not fully). I’ll explain some of the issues with SharePoint Workflow later, but first I want to describe what SharePoint workflow is. Continue reading “SharePoint Workflow and when to use it…” →

SharePoint Workflow and when to use it…

Internet Explorer can't open a new document in Library

Curious problem – I kept getting an error message “Internet Explorer has encountered a problem and needs to close. We are sorry for the inconvenience.” whenever I tried to open a document from our internal MOSS system. Strange.

Eventually figured it out from Geekette’s Blogette, and kbAlertz 833714.

We use Project 2003 still. This means two version of the owssupp.dll, apparently, under c:program filesMicrosoft Officeoffice11 and office12

I followed the advice from the MS Knowledgebase article, but got the same error as all the folks at kbAlertz. In the end I tried just uninstalling MS Project Professional 2003 support – and low, Internet Explorer started letting me open documents from MOSS again. And, much to my surprise, Project 2003 web access works just fine – I guess it doesn’t use that dll.

Internet Explorer can't open a new document in Library

Add an event handler

I keep using this snippet of code:

if( window.addEventListener ) {
window.addEventListener("load", fn, false );
} else if( window.attachEvent ) {
window.attachEvent("onload", fn );
}

It’s just a tidier way of attaching a function ‘fn’ to an event. It also allows multiple handlers per event. There could be another ‘else’ where we just assign the function to an event (e.g. window.onload = fn ) but that would only support one handler per event.

Add an event handler

The registry and "Word could not create work file"

I had an interesting problem earlier this week. I had a MOSS VM that seemed to work okay, except whenever I tried to create a document using the template on a Document Library. Then I would get the error:

Word could not create work file. Check the temp environment variable.

Okay. So I did – and the temp variable was just fine. Odd, I thought. Eventually, after digging through news groups and so on, I found a suggestion to check parts of the registry. Well, actually, one of my colleagues found it. The value in the key

HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerUser Shell Folderscache

was wrong – it pointed to an invalid directory. Not sure why, but I’d been monkeying around with some stuff which could’ve mucked it up. Anyway, fixed up the filepath in that key, and it was fine – I could create documents from Document Library templates.

The registry and "Word could not create work file"

SharePoint Folders Ending in _FILE

Here’s an interesting thing a colleague noticed – SharePoint folders with names ending in _FILE are renamed to end in _FILE_. In the image below the names and titles were the same when I typed them in:

Notice the line for A_FILE. Name and title are now different. No idea why that happens. I’m guessing that SharePoint uses folders with a suffix of _FILE for it’s own internal stuff…

SharePoint Folders Ending in _FILE

SharePoint Skinner

Themes in SharePoint are tough. I think this quote describes it nicely:

If you have attempted to override the styles on an out of the box SharePoint site, you know that it isn’t a very easy thing to do. The core.css file that contains the basic rules has 979 different style rules.

The core.css file uses a palette of 132 colors and 143 images.

The default page of a newly provisioned team site uses only 61 of those rules.

So, unless you have branded a lot of SharePoint sites and are intimately familiar with core.css and the default master pages and page layouts, just figuring out where to start modifying can be a daunting task.

So Doug has built SharePoint Skinner to make that easier. I’ve not tried it (yet) but I like his thinking…

SharePoint Skinner

Error: The event receiver context for Workflow is invalid

This is an obscure error:

Error in commiting pending workflow batch items: System.InvalidOperationException: The event receiver context for Workflow is invalid.
at Microsoft.SharePoint.SPEventReceiverDefinition.ValidContext()
at Microsoft.SharePoint.SPEventReceiverDefinition.ValidReceiverFields()
at Microsoft.SharePoint.SPEventReceiverDefinition.

GetSqlCommandToAddEventReceivers(IList`1 erds)
at Microsoft.SharePoint.Workflow.SPWinOESubscriptionService.

CommitNewSubscriptions(Transaction txn, IList`1 erds)
at Microsoft.SharePoint.Workflow.SPPendingWorkBatch.

ProcessWorkItemBatch(Transaction transaction, Work method, IList`1 workItemBatch)
at Microsoft.SharePoint.Workflow.SPPendingWorkBatch.

Commit(Transaction transaction, ICollection items)

Let’s skip over wondering what an erd is (event receiver definition maybe?)- the solution to this is simple, but not obvious. Check you have created properties for TaskID, TaskProperties and Correlation Token. I found this solution at Robert Bogue’s blog. As a side note it is a REAL pain in the ass that setting up TaskIDs and TaskProperties is so manual – or at the very least that tasks with unassigned values for these do not appear with the red ‘warning’ exclamation mark in Visual Studio.

Error: The event receiver context for Workflow is invalid