Tuesday, 25 August 2009

westernaustralia.com site re-launch on MOSS 2007

westernaustralia.com today gets a facelift on the coattails of the corporate site relaunch a few weeks back. The westernaustralia.com site is Tourism Western Australia’s premier consumer-facing web site and targets visitors seeking quality, unbiased information about Western Australia.westernaustralia.com rebrand

This is the first major visual change to the site since TWA launched WA.COM on the MOSS 2007 platform in May 2007. The site is regularly cited as an early, shining example of how far you can take custom branding and SharePoint. Under the covers, the site employs all the SharePoint tricks you’re used to: master pages, page layouts, web parts, content types, lists—you name it. The only thing we don’t make use of that might otherwise factor into a WCM site is SharePoint search and the BDC (we’ve built a custom solution for that).

The English-language sites alone delivered more than eight million page views in the last twelve months to an international audience. We currently run the site on the back of a single Windows 2003 x86 web front end (which also hosts the tourism.wa.gov.au site as a separate web app) and SQL Server 2005 database server shared by all of our MOSS-based web sites. Site traffic is additionally accelerated by Akamai and cached by regional Akamai nodes to ensure visitors can access the site quickly and reliably from all over the world.

The new changes are part of an interim visual shift as Marketing prepare for a new brand launch later this year. Apart from the look and feel, which was aimed at reducing clutter and softening existing brand elements, the site is moving towards dynamic (i.e. social) content (see the twitter feed!) and the home page in particular has been positioned to display fresh content like events and deals.

Want more? For some more examples of the heavily branded sites we’ve rolled out on the MOSS platform over the last year, check out the side bar on this page (“Some of the MOSS sites I’ve worked on”) and watch the videos (1, 2).

Disclaimer: I’m a contractor working at TWA. Mediawhole is not directly affiliated in any way with the agency or the web sites; when I say “we”, I mean the royal We.

Friday, 21 August 2009

Seeking an Experienced DBA with Strong T-SQL Skills

We’re looking for an experienced database administrator to start initially on a short term (three month) contract at Tourism WA’s Perth office. If you match this description, you do quality work, and you’re not a cocky git, please get in touch asap: info@mediawhole.com.

Required Personal Skills

  • The ability to work independently with initiative and self-drive
  • Excellent interpersonal skills
  • Excellent verbal and written communication skills
  • A sense of humour

Required Technical Skills

  • Practical experience writing Transact SQL scripts and applying relational database concepts
  • Practical experience installing, maintaining and migrating SQL Server 2000, 2005, and 2008 on 32 and 64-bit platforms
  • Practical experience configuring and maintaining SQL Server 2008 clusters
  • Knowledge of general performance testing and environment optimisation approaches
  • Practical experience performance tuning existing code (stored procedures, user defined functions, views, other queries)
  • Practical experience tuning indexes and configuring maintenance plans
  • Practical experience implementing a database server health monitoring and status alerting system
  • Practical experience with high availability techniques for SQL Server (mirroring, log shipping, etc.)
  • Knowledge of deploying C# CLR assemblies within SQL Server

Desirable Technical Skills

  • Experience maintaining product-specific database environments (specifically SharePoint/MOSS 2007)
  • A working understanding of network concepts as they relate to database administration (firewalls, TCP/IP, performance)
  • A working understanding of SAN and RAID technologies
  • Experience tuning storage subsystems
  • Experience installing and maintaining SQL Server Reporting Services (SSRS)
  • Experience creating and maintaining SSRS reports
  • Basic understanding of source control concepts

Tourism WA Corporate Site Relaunched on MOSS 2007

With the agency's first sites launched on SharePoint 2007 more than two years ago, it was recently time to give the flagship Tourism WA sites a facelift! The corporate site (http://www.tourism.wa.gov.au) is the first site to move across to an interim look and feel as Marketing prepare for the formal brand re-launch; the consumer site (http://www.westernaustralia.com) will be following next week.

Tourism WA Corporate Homepage MOSS 2007So how much effort was involved on the Corporate side? With no major content changes, it was really a question of modifying the existing CSS and and some of the images and other resources; all up, about a week's work—including a stack of minor content tweaks. Consumer has been more involved but I'll save that story for another post ;-)

Tuesday, 18 August 2009

Open Command Window Here in Windows 2008

It used to be a Power Toy now it’s baked into both Vista and Windows:

Hold down shift and right-click a folder and behold, the Open Command Window Here menu item is revealed.

Monday, 17 August 2009

Zoom for presentations

Sysinternals: what’s not to love?!

I was setting up for a demo today and noticed the client’s projector was too close to the screen and the overall result was a hard-to-read display. The Windows screen magnifier (whatever it’s called) doesn’t really cut it so on a whim I hit Google and came up with ZoomIt.

http://technet.microsoft.com/en-us/sysinternals/bb897434.aspx

129KB later and no installer I can hit CTRL+1 and this thing zooms in to my mouse; wiggle my mouse around and the zoom follows. Esc to zoom out again.

Simple. Beautiful. Perfect.

Sunday, 16 August 2009

Invalid data has been used to update the list item. The field you are trying to update may be read only.

Apparently, in my specific case today, this error message actually meant the equivalent of a runtime type mismatch.

In the context of a list event receiver, I was attempting to update one of the list item’s properties. AfterProperties is an SPItemEventDataCollection, which seems to really be a collection of strings. In trying to cram a Guid in there, I forgot to call ToString () or Convert.ToString (); the compiler didn’t complain but at runtime my friendly Guid was jailed in the bowels of SharePoint’s exception handlers. SharePoint simply returned

Invalid data has been used to update the list item. The field you are trying to update may be read only.

with nothing but a menacing smile on its horrible, scarred face.

Sunday, 9 August 2009

Event receiver doesn’t fire

It’s been a long, busy weekend and the brain’s gone to mush—so I’m making silly mistakes.

Starting with an existing, functional SPItemEventReceiver attached to a content type, I needed to add an extra event handler. I had ItemAdding and ItemUpdating wired up and debuggable but wanted to add a new ItemAdded handler.

On my first attempt, I simply added the extra handler method to my existing class derived from SPItemEventReceiver. When that didn’t work, I recalled originally wiring the individual handler methods within the content type definition so I added an extra Receiver element.

I realised my mistake when it dawned on me I was testing my changes against an existing list instance: having been provisioned using the original content type definition with only the ItemAdding and ItemUpdating event handlers, SharePoint will never update that instance retroactively without some custom code.

After creating a new list from the modified template, all three event handlers fire correctly.

Retrieving a list item’s attachments

As you might expect, accessing a list item’s attachments in SharePoint isn’t straightforward. While SPListItem.Attachments returns a string-based list of attachment names, you’ll probably need to translate that into a URL at the very least, if not manipulate the attachment itself.

It helps to understand where SharePoint stores attachments after they’re uploaded. As usual, SharePoint Manager 2007 provides some insight:List Item Attachments Location

Notice in the screenshot, I’m inspecting a list named “Announcements” and that list has one item (Hello Attachment—highlighted at the bottom). You’ll also notice there’s an Attachments folder sitting among the list items and it’s been expanded with to reveal another folder with the odd name of 2; below that you can actually see the attachment itself (My First Attachment.txt).

Before I get any further, I’ll point out the magical “2” folder isn’t magical at all: it relates to the list item in this list with the Id of 2—in this case, the Hello Attachment item (the first item in the list was deleted but, if it had attachments, there would be a corresponding “1” folder). It’s sensible to assume this structure exists to accommodate multiple attachments.

If you were to now try to access the Attachments folder in code using SPListItem.Folder, you’d be faced with a null reference exception. Instead, you need to ignore what SPM tells you about getting to the Attachments folder and arrive there instead using the parent list’s RootFolder property.

Assume you’re working within the scope of a foreach or have retrieved a list item via some other means:

SPList announcements = …Lists [“Announcements”]

foreach (SPListItem currentItem in announcements)
{
// we’re here
}

Before you do anything else, you’ll probably want to muck around and ensure you can actually access a list of attachments in some form. To identify the attachments by name, SPListItem.Attachment (SPAttachmentCollection) will return a collection of strings:

foreach (string currentAttachmentUrl in currentItem.Attachments)
{
}

At this point you’ve retrieved, from the example discussed earlier, a string like “My First Attachment.txt—not of much use on its own. As mentioned, you’re probably after the full URL at the very least.

To access the actual attachment and not just it’s name, retrieve the list item’s parent list (SPListItem.ParentList) and then the parent list’s RootFolder. From there you can use the SubFolders collection to retrieve the “Attachments” SPFolder. Beware the SubFolders indexer expects the URL of the folder, not its name.

Finally, you need to retrieve the numbered folder specific to the list item. Here’s the complete mess:

SPFolder attachments = currentItem.ParentList.RootFolder.SubFolders ["Attachments"].SubFolders [currentItem.ID.ToString ()]

The SPFolder object’s URL property can now be prefixed to the attachment’s name retrieved previously or you can enumerate the SPFiles within the SPFolder.

Back in the day, Eric Shupps posted a way to do this by walking down the structure from the Lists folder. I think the above code is a slight improvement since the code’s a bit more manageable and you don’t need to retrieve the Lists folder or the parent list by name.

Ps. RootFolder is actually quite interesting as its Name property is actually the internal name of parent SPList object.

 

Saturday, 8 August 2009

Tourism WA CIO Position Advertised

Having worked at Tourism WA in various capacities for three and a half years, I’m currently working for my third TWA CIO. As the current CIO is acting in that position, Corporate and Business Services has decided to advertise the position again (it was advertised earlier in the year until being withdrawn after the second round of interviews). If you’re interested in working at Tourism and has what it takes to fill the CIO role—and you want to work with moi), then be sure to apply:

http://search.jobs.wa.gov.au/page.php?pageID=160&windowUID=0&AdvertID=84697