Thursday, January 31, 2008

Changing to Blogger Custom Domain Breaks Windows Live Writer Images

I've been using Windows Live Writer to do my blog entries of late. I'm a fan of the UI and the user experience is quite a bit more consistent than what I was getting using the Blogger WYSIWIG. I finally mustered up the courage the other day to move from my old blogger sub domain http://systemdotwhat.blogger.com to a more fancy http://blog.tylerholmes.com. I was rewarded for this effort by having all the images in the posts that I did with Windows Live Writer break.

I was annoyed to say the least. While I haven't found a way to fix all the broken images (besides downloading them from Blogger or Picasa and uploading them again), I did notice that if you update your Windows Live Writer profile with your blog changes future posts will no longer result in broken images. Here's the steps.

Changing to a Custom Domain and Updating Windows Live Writer

  1. First run the Blogger steps to start using custom domain (found here).
  2. This will break all the posts you've done with Windows Live Writer, you'll need to go back and fix them, either by editing old posts and fixing the links or by re-uploading broken images.
  3. Update Windows Live Writer to use your new Blogger settings, this will enable future posts through Windows Live Writer to upload images to Picasa that are accessible. You can do this by opening Live Writer, navigating to Tools->Accounts->Click Edit on the account with the custom domain-> Update Account Configuration->Update your new Home Page URL and click Next through the wizard.

Updating Windows Live Writer to Custom Domain

Simple huh? Well the first time through it's frustrating and confusing as hell. I'm not sure who to blame, Live Writer, Blogger or Picasa.

Anyway's, I hope it helps. Blogging can be tedious enough as it is.

My Best,
Tyler

Wednesday, January 30, 2008

Improperly Configured Service Accounts in SharePoint 2007

Anyone who runs SharePoint 2007 for more than a couple days quickly becomes familiar with the litany of errors that show up in the even log. Even scarier is the series of random fixes we some how seems to put together. From the Local Activation error to authentication errors it's startling just how many error codes you can look at and say "oh yeah, you just need to head into the registry and... or yeah that's under the Central Admin...".

Here's another one, the error is:

Event Type: Error
Event Source: Office SharePoint Server Event
Category: Launcher Service
Event ID: 6102
Date: 1/30/2008
Time: 10:10:55 PM
User: N/A
Computer: W2K3-TYLER-VIRT
Description: LoadBalancer.RegisterLauncher failed: Unable to connect to the remote server.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

This usually happens when the Document Conversions Load Balancer Service is using a bad service account. Try the following.

Configuring Service Accounts

  1. Head to the Central Administration->Operations. Under Security Configuration click on Service account. Service Account area of Central Administration
  2. Click the Windows Service radio button and select Document Conversions Load Balancer Service. Ensure that it is set to a proper service account. Setting Document Conversions Load Balancer Service to a service account

Give it a good 20 minutes to make sure that this is really fixing the problem. If it doesn't then try and you don't want to run the service in the first place then you can just stop the service.

Stopping Services on the Server/Farm

  1. Open up the Central Administration->Operations->Services on Server.
  2. Click Stop next to the Document Conversions Load Balance Service. You may want to stop the Document Conversions Launcher Service too.Stopping Document Conversion Laucher Service

Still waiting for a stock install of SharePoint 2007 to run without screaming red in the event log (even with SP1).

Patiently,
Tyler

Sunday, January 27, 2008

Free XSLT Debugger: Visual Studio (2005/2008)

I know Visual Studio 2005 has been around for quite some time now, but I'm still discovering new things that it can do. I'm a light weight when it comes to XSLT and so I was definitely going to need some help when it came time to transform some RSS into an HTML document.

I actually spent some time online digging around for a good XSLT IDE and found some pretty complete offerings, unfortunately a lot of them also wanted a fair bit of money. What really surprised me is when I discovered that Visual Studio will actually debug XSLT! I remember back in the day this was a HUGE feature that we wished VS 2003 had (a company I was working for at the time ended up buying a plug in from Active State which did just that). What's even better is that Visual Studio 2008 will actually show you where you are in the XML document as you debug. It's important to note that this is available for all editions (Express to Team). I'm ever more surprised at just how many features you can get in a free IDE these days. Any way here's what the debugging experience looks like.

Steps to Debug

  1. Fire up Visual Studio, File->New->XSLT File.
  2. In the properties pane (press F4 if it's not already visible) enter the Input file (could be an XML file or a URL).
  3. Type out some XSLT (with intellisense) an when you want to check your markup put down a break point (press F9), navigate to XML->Debug XSLT.
  4. You can now enjoy a full debugging session and evaluate XPath and XSLT expressions on the fly either in the Quick Watch window or the Immediate window.

Not too shabby for zero dollars.

Cheers,
Tyler

Friday, January 25, 2008

Enabling Anonymous Access in SharePoint 2007

It wasn't too long ago that I was trying to get my favorite Web Part (Content Query Web Part) to pull an RSS feed form a SharePoint list. Web Part was giving me a lot of grief, repeatedly giving me the error:

Cannot retrieve the URL specified in the XML Link property. For more assistance, contact your site administrator.

It took me a while to piece together that this Web Part does NOT run in the context of my given SharePoint credential when it comes to fetching this RSS. In fact I don't know of ANY RSS able Web Parts that support authenticated feeds.

As a work around I had to enable Anonymous Access for the given list. I was quite surprised when after some research I discovered that SharePoint allows you to turn on annonymous access for any of the following:

  • Everything on a site (ie. 3 sites out of a site collection)
  • Any combination of Lists and Libraries on a given site
  • No anonymous access at all

For my needs I wanted to turn it on for just ONE list (the one I wanted to expose and consume the RSS feed for). Here's how to do it.

Enabling Anonymous Access for a Single List

  1. The first thing you need to do is turn on anonymous access for the web application, this is done through the Central Administration UI. Open up the Central Administration web page, go to the Application Management tab and click on Authentication Providers under Application Security (see below).
  2. Now that this application allows anonymous access we need to turn it on for the given site. Go to the site you want to turn on anonymous access on, navigate to Site Actions->Site Settings->Modify All Site Settings. From here click on Advanced Permissions. Open up the Settings menu on the tool bar and then click Anonymous Access. Finally choose (for this example) "Lists and libraries". We're going to turn on anonymous access for exactly one list.
  3. Finally go to the list you want to turn on anonymous access for and in the List Settings, Permissions for this List and then expand the Settings menu and click Anonymous Access. From here you simply select the rights you want to give anonymous users for this list. In this case we simply choose View Items.
  4. That's it, that RSS feed should now be working!

Cheers,
Tyler

Thursday, January 24, 2008

Migrating (Moving) SharePoint 2007

Until you actually embark on the task you'd never imagine exactly how difficult it is to sift through all the documentation and HOWTO's on how to move a WSS or MOSS instance from one machine (or farm) to another. Here's an extremely simple technique on how to do just that, funded most generously by a day's labor.

Potential Techniques

There's a lot of ways to move around SharePoint content. Among the most popular is probably the SharePoint Designer and the stsadm.exe tool. Surprisingly enough it's the stsadmn tool that is by far the easiest to work with. I've found that the SharePoint Designer backup/restore process dies all to easily when you're missing an assembly or a <SafeControls> declaration. The stsadm tool however keeps on trucking, which makes it an awesome way to go if you can get access to it. If not, then by all means use the SharePoint Designer. A decent article for using the frustrating technique is available here.

What You Need

A WSS/MOSS instance that's running (the url is accessible) and ready to go. You can of course continue to change it after you modify it but ideally it's ready to be deployed.

What You Should Know

This technique copies EVERYTHING in the content database which is awesome. This includes content types, site columns, lists (and their contents) etc...

What's NOT copied is any application code that you may have dependencies on. This may include Custom Web Parts, custom ASP.NET codes that you've imbedded in SharePoint, Custom Fields, Event Receivers etc...

You will have to copy these assemblies over (usually just the bin directory) manually and then update the web.config on the destination machine with the appropriate <SafeControls> entries and trust levels.

Performing the Backup

1. On the source machine find the stsadm tool (it's normally located at [C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN]). Run the following command.

stsadm -o backup -url http://mysite/ -filename file.bak

2. On the destination machine, use the SharePoint administration website to create a new Web Application and a new SiteCollection, choose a Blank Site as a Site Definition.

3. Copy the .bak file to the destination machine.

4. Run the following command.

stsadm -o restore -url http://mysite2/ -filename file.bak -overwrite

5. All the content has now been moved, all you need to do now is merge the web.config from the source machine with the destination machine and copy over all the assemblies in the bin folder. Everything from Web Parts to custom codes should be there!

Happy Coding,

Tyler

Sunday, January 20, 2008

Customizing SharePoint 2007 List Forms (DispForm.aspx, NewForm.aspx, EditForm.aspx)

[Updated Feb 27, 2008] It's important to note that customizing forms breaks attachment support! If you're going to be attaching documents to these list items you will either need to write code to upload the attachments yourself or NOT customize the form. This is still not fixed with SP1.
When you create a new list in SharePoint, a default form for viewing, editing and adding are provisioned for you by SharePoint. This is also true for any views that you define on the list. SharePoint creates an .aspx page at http://siteroot/Lists/ListName/DispForm.aspx. You can see all these pages using the SharePoint Designer.


Be default they are basically a WebPartZone with a ListFormWebPart inside.

The real story though is that you can customize these lists. Not only can you very easily create your own, but you can tell the list to always use your form. You can even tell the list to use your form for certain Content Types (if the list has multiples) and use the default Form for other Content Types.

Creating a Custom List

In the following example we're going to create a new Form for adding contacts, then we'll have SharePoint Designer change it so that it can use the current master page and participate in any branding effort you may be doing.

  1. Right click on the list (ie. Contacts) then go to New->ASPX.
  2. Rename the form to something that makes sense (ie. NewContact.aspx)
  3. Now we need to turn this blank form into a page that can view content from the list. Double click on the form. Once it's in focus in SharePoint Designer on the toolbar click Insert->SharePoint Controls->Custom List Form (see below). In the popup choose your list (ie. Contacts) and the type of form you want to customize (ie. NewForm). Notice that you can also choose a Content Type to customize the forms for. You can literally have a separate customized 'NewForm' for each Content Type that the list stores. Click Ok and watch as your form gets automagically tee'd up with all the controls it needs allow users to add Contacts to the list.

  4. Now that we have a form that can add new Contacts, lets make sure it enforces our brand by attaching a Master Page. Click Format->Master Page->Attach Master Page. Choose the 'Default Master Page' and watch SharePoint Designer neatly place all the markup that matters inside of a ContentPlaceHolder and attach the current runtime master page.
  5. Ok our last step, we need to tell our list to use our new customized form. Right click on the list in question. Click 'Properties'. Click on the 'Supporting Files' tab and then change the 'New item form' to the .aspx you just made. It's of note that the .aspx needs to be housed inside the list, you can't just house it anywhere.
  6. You're done, head back to your contacts list (in SharePoint and add a new item, you'll see the form that we just made). You can of course do the same for DispForm.aspx and EditForm.aspx.

Here's a screen shot of some text that we changed on the form. Future posts will get into actually working with SharePoint controls and putting a code behind on the form, so you can write some C# to alter the behavior of this form (in addition to changing the declarative markup in this .aspx).

Ok, that's it for now. Good luck.

-Tyler

Windows Live Writer For Blogger Accounts

I'm an impatient man. Pretty much all of the patience I have these days is a direct result of developing for Windows and web platforms for the last 6 years. Let's be honest, that'll really only get you so far!

It should come as almost no surprise that I'm pretty critical when it comes to the myriad of tools that decorate my work day. This is the first of potentially many entries that will be authored with Windows Live Writer. I've decided to give this product a try. This post is just that, a product of me trying to figure out how this client side app works.

This mostly stems from the fact that the Blogger WYSIWYG editor is terrible to blog with. It renders/behaves inconsistently between IE7/FF/Safari and handles pictures poorly. It also lacks the ability to highlight and handle code snippets well.

Setting up Live Writer is pretty straight forward. The only real complicated step is trying to determine your Blogger Feed-Id.

To find your Blogger Feed Id:

1) Go to your blogger home page (ie. http://systemdotwhat.blogspot.com).

2) Right click and choose to 'View Source'.

3) You're looking for some text that looks something like below:

<link rel="service.post" type="application/atom+xml" title="It's in System.What? - Atom" href="http://www.blogger.com/feeds/[YourFeedId]/posts/default" />

4) Use the feed id and you should be fine.

Happy Blogging,

Tyler