Click here to Skip to main content
14,269,538 members

Live Writer Plug-in for Sharing Technical Post

Rate this:
5.00 (3 votes)
Please Sign up or sign in to vote.
5.00 (3 votes)
17 Jul 2010Ms-PL
Describes how to write a Plug-in for Windows Live Writer

Adding a new post to my blog was always a daunting task.
I had to follow these steps:

  • Write the post on Windows Live Writer
  • Publish it and get the post link
  • Submit to DotNetKicks and get their counter HTML
  • Submit to DotNetShoutout and get their counter HTML
  • Prepare HTML for my CodeProject blog feed
  • Edit the post and add the HTML I've collected in the previous steps
  • Republish post

Well, no more!

Inspired by Guy Burstein’s post, I've decided to write my own Live Writer Plug-in that will handle all of this mess for me.

In order to test the plug-in, I have to publish something on my blog.
So, this is it. Wish me luck.

How to Implement a Windows Live Writer Plug-in that Adds Sharing Buttons to your Post

First, credit goes to Guy Burstein for providing a reflectable DLL in his post.
Also, I've used guidelines for Windows Live Writer Plug-in written by Scøtt Lovegrove.

The end result is a plug-in that adds to your posts the following share icons:


Since enough information already exists on this subject, I'll just quickly review the steps I've followed:

  1. Create new Class Library project, using .NET Framework 2.0 (!).
    Not sure why, but Microsoft recommends to use version 2.0 of the .NET Framework when writing a Windows Liver Writer plug-in.
  2. Add reference to WindowsLive.Writer.Api.Dll, which resides in the Windows Live Writer folder (e.g. \Program Files\Windows Live\Writer\)
  3. Add “using WindowsLive.Writer.Api;
  4. Create a class that inherits HeaderFooterSource.
    This type of plug-in allows us to add custom generated HTML in either the header or the footer of the post.
  5. Put WriterPlugin attribute on the class.

Here is the code for a basic version of the plug-in (only has one button):

using System.Text;
using System.Windows.Forms;
using WindowsLive.Writer.Api;

namespace ShareTechPost
        "Share Technological Post",
        PublisherUrl = "",
        Description = "A plugin that lets you share a technological" + 
                      " post on numerous sharing sites.",
        ImagePath = "writer.png", 
        HasEditableOptions = true)]
    public class ShareTechPostPlugin : HeaderFooterSource
        private Settings _settings;

        public override bool RequiresPermalink
                return true;

        public override void Initialize(IProperties pluginOptions)

            _settings = new Settings(pluginOptions);

        public override void EditOptions(IWin32Window dialogOwner)
            SettingsForm settingsForm = new SettingsForm(_settings);

        public override string GeneratePreviewHtml(
            ISmartContent smartContent, 
            IPublishingContext publishingContext, 
            out Position position)
            position = Position.Footer;

            StringBuilder generatedHtml = new StringBuilder();

            if (_settings.AddDotNetKicks)
                    ("<a href=\"" + 
                    "?url={0}\"><img border=\"0\" "+
                    "alt=\"kick it on\" " + 
                    "src=\"" + 
                    "Services/Images/KickItImageGenerator.ashx" + 
                    "?url={0}&amp;bgcolor=6600FF\" /></a> ",
            return generatedHtml.ToString();

        public override string GeneratePublishHtml(
            IWin32Window dialogOwner, 
            ISmartContent smartContent, 
            IPublishingContext publishingContext, 
            bool publish, 
            out Position position)
            return GeneratePreviewHtml(
                out position);

The Settings class and SettingsForm just lets you control some of the sharing options.

This is how the settings form looks like:


You can find the full source for this plug-in here.

That’s it for now,
Arik Poznanski.

Image 6Image 7


This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


About the Author

Arik Poznanski
Software Developer (Senior) Verint
Israel Israel
Arik Poznanski is a senior software developer at Verint. He completed two B.Sc. degrees in Mathematics & Computer Science, summa cum laude, from the Technion in Israel.

Arik has extensive knowledge and experience in many Microsoft technologies, including .NET with C#, WPF, Silverlight, WinForms, Interop, COM/ATL programming, C++ Win32 programming and reverse engineering (assembly, IL).

Comments and Discussions

GeneralMy vote of 5 Pin
Kunal Chowdhury «IN»17-Jul-10 19:59
mentorKunal Chowdhury «IN»17-Jul-10 19:59 
GeneralNice one but... Pin
Kunal Chowdhury «IN»17-Jul-10 18:33
mentorKunal Chowdhury «IN»17-Jul-10 18:33 
GeneralRe: Nice one but... Pin
Arik Poznanski17-Jul-10 19:45
memberArik Poznanski17-Jul-10 19:45 
The Plug-In was written first to help me.
I always use Live Writer and always from my laptop.
So, in my case, it is very helpful.

That being said, I see why not every technical blogger will be satisfied.
Thanks for your comment.
Arik Poznanski

GeneralRe: Nice one but... Pin
Kunal Chowdhury «IN»17-Jul-10 19:58
mentorKunal Chowdhury «IN»17-Jul-10 19:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Technical Blog
Posted 17 Jul 2010

Tagged as