Writing Plugins For Windows Live Writer – Getting Started

In this article, I am going to show how to create a simple plugin for Windows Live Writer, starting from the beginning. Writing plugins for Live Writer is simple enough, but sometimes you just need a little helping hand, and I’m speaking from experience .
First off, you will need to make sure that you have the required programs. Make sure that you have the following installed:
  • Windows Live Writer – download
  • Microsoft .NET Framework v2.0 – download
  • Visual Studio Express C# Edition – download (this link takes you to an installer that will require you to download the rest of the files).
Once you have installed them then we are ready to go. Open Visual Studio and start a new project, selecting Class Library andgive the plugin a name. For this example, I will call it MyNewPlugin.
Now we need to tell the plugin to look at the Windows Live Writer API. In the Solution Explorer on the right hand side, right click on the References folder and select ‘Add Reference’ and browse to the Live Writer folder in your Program Files folder. The dll we want is WindowsLive.Writer.API.dll:
Now that the reference has been create we need to tell the plugin to actually use the APIs, so we need to add
using WindowsLive.Writer.Api;
You should also add the reference for Windows Forms. So, following the same procedure we have just done, add the System.Windows.Forms reference from the .NET section, and again tell the plugin that we need to use it
using System.Windows.Forms;
Next we need to set the plugin’s attributes:
    [WriterPlugin("8638eda4-6533-4d19-9da7-ff92ff5a7590","My First Plugin",
Description="This is my first plugin",
Name="My First Plugin",
Now, the first thing you see in those attributes is the GUID (the combination of numbers and letters), this is unique to each plugin that you make. To get the GUID for your project, right click on the project name in the Solution Explorer and click on properties, then click on the Assembly Information button in the next screen:
The second string is the text that will appear in Live Writer’s Plugins section in the Options; the Description is what appears underneath the list of plugins when you have clicked on your plugin in the options of Live Writer; HasEditableOptions is either true or false and this tells Live Writer whether to put an options button in the Plugin options (for most plugins you probably won’t need this set to true, and you certainly don’t for this example); PublisherUrl is where you put the link to your site.
Underneath the WriterPlugin code, we need to set what text appears in the Insert section. So we use the code:
[InsertableContentSource("From MyNewPlugin")]
Time to declare the plugin’s main class
public class NewPlugin : ContentSource
public NewPlugin()
Note: after declaring the public class, you must call that class, but keep it empty as in the example above.
Next we need to override the main class (this is why it was left blank), and we put in the following code:
public override DialogResult CreateContent(IWin32Window dialogOwner, ref string newContent)
The ref string newContent is what actually gets put back into the blog entry, so we need to set that to equal something:
newContent = "This was put in by my first Live Writer Plugin :)";
Because of how the override works, we need to return a DialogResult of OK (I will go into this in more detail in another post), so we simply put in:
return DialogResult.OK;
Close off anything that is open (ie, }). That is your plugin written, now we need to build it. Before we do though, we should add a command into the post-build section. So, right click on your plugin name in the Solution Explorer and click on properties. Select the Build Events section and copy the following command into the post-build event section:
XCOPY /D /Y /R "$(TargetPath)" "C:\Program Files\Windows Live Writer\Plugins\"
Now we are ready to build the plugin. Hit F6 on your keyboard and watch the fun begin . Once the build has finished successfully, open up Windows Live Writer and in the Insert section, you will see your link:
Click it and you will see the text we set for newContent is now in your blog entry. So we have now created a basic plugin for Windows Live Writer
Download the sourcecode for this example here.
Next time I will talk you through how to add an image to your link.
  1. #1 by Ping on June 24, 2007 - 11:15 pm

    brilliant article, very helpful for beginners

  2. #2 by Scott on June 25, 2007 - 12:31 pm

    Thanks for the feedback :)SL

  3. #3 by Brett on July 23, 2007 - 7:14 pm

    Scott, great job on the how-to series.  Just downloaded your Amazon plug-in!  Thanks a million, mate! 

  4. #4 by Unknown on January 21, 2008 - 3:40 pm

    wow gold wow gold wow power leveling wow power leveling wow powerleveling wow powerleveling wow power leveling wow gold wow gold World of Warcraft Gold rolex replica wow power leveling wow power leveling wow power leveling wow power leveling wow power leveling wow power leveling wow power leveling power leveling power leveling power leveling rolex rolex power leveling power leveling power leveling wow powerleveling wow powerleveling wow powerleveling wow powerleveling wow powerleveling wow powerleveling powerleveling powerleveling powerleveling wow gold powerleveling powerleveling powerleveling World of Warcraft Gold World of Warcraft Gold World of Warcraft Gold World of Warcraft Gold World of Warcraft Gold rolex replica Warcraft Gold Warcraft Gold Gold wow Gold wow Gold wow Gold wow Warcraft Gold Warcraft Gold 货架 机票 灭蟑螂 租房 租房 北京租房 北京租房 搬家公司 北京搬家 北京搬家公司 上海机票 上海机票 上海打折机票 上海打折机票 上海特价机票 上海特价机票 搬家公司 搬家公司 北京搬家公司 北京搬家公司 中高年 転職 アルバイト 求人情報 ブライダル 転職 競馬 FX ダイエット お見合い 競馬 予想 新築マンション 新築マンション コンタクトレンズ 婚約指輪 合宿免許 人材派遣 東京都 墓地 派遣会社 人材派遣 パチンコ 攻略 おなら sfdggjhhkg

  5. #5 by on April 15, 2008 - 9:03 am

    wow gold!All US Server 29.99$/1000G on sell! wow gold,WOW Power Leveling-We supply the cheapest WOW PowerLeveling Service Online,with cheapest price and fastest of World Of Warcraft Gold and World Of Warcraft Power Leveling when purchaseing Honor Points/Professions Skills/Rep/World Of Warcraft PowerLeveling.
    Alcohol Tester purchasing center is a professional enterprise Breathalyser,Breathalyzer specializes in breath Gas Alarm consulting,Gas Detector through internet.Co Detector,Co Alarm always have been designed to alarm.

  6. #6 by Unknown on April 26, 2008 - 10:28 am

    wow gold cheap wow gold buy wow gold world of warcraft gold wow world of warcraft wow gold WoW Warrior WoW Hunter WoW Rogue WoW Paladin WoW Shaman WoW Priest WoW Mage WoW Druid WoW Warlock maple story maple story mesos maplestory mesos maplestory maple story mesos maple story cheats maple story hacks maple story guides maple story items lotro lotro gold buy lotro gold lotro cheats lotro guides power leveling powerleveling wow power leveling wow powerleveling google排名 google左侧排名 google排名服务 百度推广 百度排名 wow guides wow tips 商业吧 网站推广 福州热线 体育博客 股票博客 游戏博客 魔兽博客 考试博客 汽车博客 房产博客 电脑博客 powerlin518 logo design website design web design 商标设计 办理上网文凭 高考答案 窃听器 手机窃听器

  7. #7 by Unknown on May 6, 2008 - 12:50 pm

    キャッシング 比較
    消費者金融 審査
    キャッシング ローン
    キャッシング 申込
    即日 キャッシング
    大口 融資
    低金利 キャッシング
    高額 融資
    低金利 ローン
    大口 ローン
    消費者 金融 審査 甘い
    カード キャッシング
    主婦 キャッシング
    ネット キャッシング

  8. #8 by Unknown on July 14, 2008 - 12:09 am

    主婦 キャッシング 銀行系 キャッシング キャッシング 即日融資 女性専用 キャッシング 一本化 ローン 一本化 借金 一本化 まとめ 一本化 銀行 おまとめローン カードローン 審査 ローン 借り換え 銀行系 カードローン レディースローン カードローン 低金利 即日融資 大口融資 高額融資 消費者金融 即日融資

  9. #9 by on August 7, 2008 - 6:51 am


  10. #10 by Unknown on September 12, 2008 - 10:50 am

    高卒求人 高卒求人 日総 高卒求人 日総 日総 風俗求人 池袋 風俗 高卒求人 高卒求人 日総 日総

  11. #11 by Unknown on September 30, 2008 - 4:12 pm

    Hi,Do you need advertising displays, screen advertisings, digital sign, digital signages and LCDs? Please go Here:www.amberdigital.com.hk(Amberdigital).we have explored and developed the international market with professionalism. We have built a widespread marketing network, and set up a capable management team dedicated to provide beyond-expectation services to our customers.
    amberdigital Contact Us

  12. #12 by Unknown on October 26, 2008 - 7:12 am

    Hi,Do you have used LCDs, second hand LCDs, used flat screens and used LCD monitors? Please go here:www.sstar-hk.com(Southern Stars).We are constantly buying re-usable LCD panels and working for LCD recycling.The re-usable panels go through strictly designed process of categorizing, checking, testing, repairing and refurbishing before they are re-used to make remanufactured LCD displays and TV sets.Due to our recent breakthrough in testing and repairing technology of LCD, we can improve the value for your LCD panels.

  13. #13 by Unknown on November 7, 2008 - 3:53 am

    New battery fit Acer LCBTP03003 SQU-401 laptop battery
    Battery for Acer Ferrari 4000 4002 4003 SQU-410 laptop battery
    Acer Aspire 3633 SQU-519 Battery 916C4820F laptop battery
    laptop battery for 3UR18650F-3-QC151 tm3200 laptop battery
    New Battery Acer TravelMate 3002WTCi 3002WTMi laptop battery

    Battery ACER Travelmate 4200 4203 4230 4260 4280 laptop battery
    Battery fits ACER BATCL32 BATCL32L BT.A1405.001 laptop battery
    Battery For Acer Travelmate 200 210 BTP-33A1 BTP-35A1 laptop battery
    battery for Acer TM 520 Hitachi PC-AB6000 BTP-34A1 laptop battery
    ACER Aspire 1500 1501 1502 BATTERY BTP-55E3 BTP-67EM laptop battery
    battery for acer BTA0302001 BAT0302003 1300 1310 laptop battery

    Battery fit ACER SQU-302 SQU302 Aspire 1350 1510 Li-ion laptop battery
    laptop battery for acer 1800 series batecq60 laptop battery
    NEW Hi-Cap 5500mAh Battery for MacBook 13 A1185 WHITE laptop battery
    Black NEW Hi-Cap 5500mAh Battery for MacBook 13 A1185 laptop battery
    Apple Genuine Battery for 15 inch MacBook Pro A1175 laptop battery
    Battery 4 PowerBook G4 12 A1022 A1060 A1079 M9324 laptop battery

    Genuine A1078 Battery Apple PowerBook G4 15-inch laptop battery
    Battery For ASUS A3 A3E A3G A3L A42-A3 A3000 Z91 A3L A6 laptop battery
    A42-A2 Battery to ASUS A2C A2D A2000 A2500H A2S A2K Z80 laptop battery
    Battery For Asus 90-N40BT1220 90-441B3100P 70-N451B1200 laptop battery
    Battery For ASUS A32-A8 A8JC A8JM A8C A8F Z99 A32-A8 A8 laptop battery
    Battery For ASUS A31-S5 A32-S5 S52N S5000 S5200N S5N black laptop battery

    Battery For ASUS A31-S5 A32-S5 S52N S5000 S5200N S5N white laptop battery
    Battery For ASUS L3 L3D L3000 L3400 L3500 L3800 A42-M2 laptop battery
    Battery fit ASUS A42-A4 A4000 A4D A4K A4G A4S A4L A4Ga laptop battery

  14. #14 by T8tube.com on May 29, 2009 - 3:30 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: