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

Adding Snippets in Visual Studio

I keep forgetting how to do this, and have to do so every time I want to create a new SharePoint workflow.

  1. Open Visual Studio.
  2. Right click on toolbars and ‘Customize’
  3. Click ‘Commands’ Tab.
  4. Click on the ‘Tools’ category.
  5. Add the ‘Code Snippets Manager’.
  6. Add ‘C:Program FilesMicrosoft Visual Studio 8Xml1033SnippetsSharePoint Server Workflow’ to your snippets
  7. It should be straight forward from there…

Comments from my old blog:

Are you using your own project templates? I’m curious because using the MOSS Workflow Project templates (both state machine and sequential)–the templates that come with the MOSS SDK–and I have the snippets already available to me.

Anyway, just throwing that out there.

By Peter {faa780ce-0f0a-4c28-81d2-3 at 17:30:01 Monday 10th September 2007

Nope, these are the ones out of the SDK. I’m not clear why, but in some VMs that I use the snippets aren’t immediately available after I install it. And normally the ‘Code Snippets Manager’ is already available too – but not always. I haven’t figured out what factor causes these things to occur :/

But yes Peter, you’re right – normally they should be available.

By Andy B at 11:16:21 Tuesday 11th September 2007

Adding Snippets in Visual Studio