Windows Live Writer’s New APIs, Deployment Methods And A Hidden Extra

With last week’s release of beta 2 of Windows Live Writer, the Writer Team released a new set of API documentation, but not for plugin development (sadly), rather for Blog Service Providers to enable features within Writer itself. This means that if a blog service enables a feature that Writer can use, say the excerpt feature, then they can create a new wlwmanifest.xml that goes in the root of the blog directory, Writer will then detect this file and enable the features as described in that manifest file.

To try this out, I used my test blog to change some of the settings, just simple things like the text to display to open the blog from within Writer. The results looked like this:


As you can see, I have just replaced Blog with Ferret. Of course, there are a whole host of settings that can be enabled and changed, all of which are documented on MSDN. The XML file that I used for this is as follows:

<?xml version="1.0" encoding="utf-8" ?>
<manifest xmlns="">
    <serviceName>Ferret Blogger</serviceName>
    <homepageLinkText>View your Ferret</homepageLinkText>
    <adminLinkText>Edit your space</adminLinkText>

There is a great, real usage of this that Scott Hanselman has made for a newer daily build of dasBlog, where he shows some of the changes you can make, like including your own buttons.

One of the other new changes in Writer is the deployment methods for plugins. There are now two additional methods other than hard coding the installer to put it in %ProgramFiles%Windows Live WriterPlugins. The new installer creates a registry entry for the InstalDir which the installer can get the install directory from, and then work it from there. Or you can put your plugin in a directory of your choice, and install a registry key to tell Writer where the plugin is located. This latter method is actually the one my own plugins will now be using, the new installers for those will be rolling out soon.

Now, the hidden extra that I mention, is actually something that is in the plugin APIs, and has actually been there the whole time; the difference being, up until now, it didn’t do anything. If we go back to my original tutorial, we had this for the CreateContent method that we override:

public override DialogResult CreateContent(IWin32Window dialogOwner, ref string newContent)

Well in this method we get passed a string reference called newContent, which, with the release of beta 2 of Writer, now actually does something. If you highlight any text within the editor and click on a plugin, then the plugin will receive the full HTML code for the highlighted text, which you can then use in your plugin. This can be seen in use in my I’m Feeling Lucky plugin.

Note: I should mention, the newContent part is only for simple plugins, this won’t work with SmartSource plugins.