Windows Live Writer has almost become the de-facto client blogging tool on Windows to compose and post blogs on various blogging sites. It is more popular among Microsoft community as it is developed using .net technology. Its still in its beta stage but much popular than lots of production ready tools.
Apart from its simple UI, the most powerful feature of Live writer is its extensibility. There are already thousands of plugins available on web to extend your Live Writer Installation. As its developed using .net, the plugins can also be written in .net using CSharp or VB.NET.
The sdk for Live Writer provide two types of content sources :
- Simple : for inserting custom HTML into post.
- Smart : for inserting html content with editing capabilities using sidebar.
The main steps in writing a Live Writer Plugin are :
- Create a new 'Class Library' type of project.
- Include reference to WindowsLive.Writer.Api assembly provided with sdk.
- Add namespace WindowsLive.Writer.Api to the project main cs file.
- Create your plugin class inheriting ContentSource class.
- Override CreateContent method.
- Build the assembly and copy it to C:\Program Files\Windows Live Writer\Plugins\ folder. That's it .. done :-)
- Below is the complete code for a plugin which will insert following tags to the post :
Add to : del.icio.us Digg this Technorati
The source code :
using System;
using System.Collections.Generic;
using System.Text;
using WindowsLive.Writer.Api;
using System.Windows.Forms;
namespace VikasGoyal.WriterPlugin
{
[WriterPlugin("25522063-0a17-47af-ad69-cc284bcb80ef", "Add To Favourites",
PublisherUrl = "http://dotnetwithme.blogspot.com",
Description = "Add to Favourties for various bookmarking sites")]
[InsertableContentSource("Add To Favourties")]
public class AddToFavourites : ContentSource
{
public override DialogResult CreateContent(IWin32Window dialog, ref string content)
{
DialogResult result = DialogResult.OK;
content = "<p><font face=\"Verdana\"><b><font color=\"#FF0000\">Add to :</font></b>" +
"<a href=\"http://del.icio.us/post\">del.icio.us</a> " +
"<a href=\"http://digg.com/submit\">Digg this</a> "+
"<a href=\"http://www.technorati.com/faves\">Technorati</a> </font></p>";
return result;
}
}
}
Some related links :
Other Posts
- Performance Analysis/Tuning of ASP.NET Application
- Auto Performance Tuning in ASP.NET 2.0
- Overview of Interoperability with UnManaged world
- Tutorial : Developing a state machine workflow
- Windows Workflow Services Overview
- How to create Rule based condition for sequential workflow
I had a double take when I read the title of this article, "Writing Plug-in for Windows Live Writer - It can't get easier". It seems to me that an app should not need a plug-in to fulfill its main function. Are you going to have another article entitled "Messaging Plug-in for Windows Live Messenger"?
ReplyDelete