Thursday, October 23, 2008

Including XML in your Blog posts

I was looking for a way to post XML in my Blog posts.

Here is the solution: http://www.elliotswan.com/postable/

When you first hit the page you may think that the page didn't load properly. But what you actually need to do is:
Copy and paste your xml into the area under "For your copy-and-pasting pleasure" then click the "make it friendly".

Then you can copy and paste resulting text in your blog posts.

Great work Elliot!

Sharepoint & Melbourne Daylight Savings

I'm currently experiencing an issue where the Sharepoint timer service is kicking off an hour early. My network infrastructure people have assured me that they've installed all the service patches for all the servers.

A colleague found this MS KB Article: http://support.microsoft.com/kb/888253

And it seemed to be the solution. But when I checked my TIMEZONE.XML file the Daylight saving date appears to be correct:

<DaylightTime>
<Bias>-60</Bias>
<Date>
<Month>10</Month>
<Day>5</Day>
<Hour>2</Hour>
</Date>
</DaylightTime>

That is the correct date and time for Melbourne (this year) as per this page.

FYI I'm on the MOSS and upto version 12.0.0.6318 (Infrastructure update).

Chris Armstrong has also blogged about this yesterday (darn beat me by one day) but the daylight saving start date he uses don't appear to be correct. I'll make another post once I have a solution.

Wednesday, October 15, 2008

Running javascript after window.onload without breaking Sharepoint

If you're anything like me and are working with a lot of Javascript within Sharepoint. You will eventually need to run a script after the page loads. So you could add defer="defer" to your script tag, which sometimes works and sometimes doesn't.

You might be tempted to window.onload = someFunction(). But this will break the way Sharepoint load's it's pages. As Sharepoint also needs to do a lot of things after the page loads.

So the solution is:
window.attachEvent("onload", someFunction);

So instead of overriding the onload event. You are now adding an event to the queue. Simply replace the "someFunction" bit with your function name.

Sunday, October 5, 2008

Create a new form in Infopath without opening up a Form Library

I found this post and I thought it was really neat. Basically you can create a link anywhere in Sharepoint that creates a new form in Infopath without prompting the user for the "Open, Save As, Cancel" prompt. All you have to do is put this on your page. Change YOURSEVER with your server name, SITE to your site(s) name and FORM LIBRARY with your form libary name:

<a href="javascript:createNewDocumentWithProgID(
escapeProperlyCore('http://YOURSERVER/SITE/FORM LIBRARY/Forms/template.xsn', true),
'http://YOURSERVER/SITE/FORM LIBRARY/',
'SharePoint.OpenXMLDocuments',
true)">Create a New Document</a>