Creating a Basic Metaweblog API Blogging Client in C#

Originally published: 06/2006 by J Wynia

I'm on a longstanding quest to find a better application from which to build up posts and put them into Wordpress. It's not as big of an issue here, but I'd like to branch out more into some other sites and need some better tools (or better suited to my way of working).

To that end, I've been messing around a bit with building my own power blogging client. I've got a pretty good sized mindmap in Freemind with my outline and requirements for what I want it to do.

What I'm actually after is a powerful tool for researching, composing and publishing posts. That includes keyword research, image gathering, source reading (RSS reading and sorting, etc.), draft capabilities that span multiple computers, advertising or affiliate program integration, etc. All of it included in a "geeky" package without WYSIWYG editing and the other stuff aimed at beginners. There is an ever growing pile of tools that are aimed at that crowd already. And, every one of those tools frustrates me.

So, to build my own. I've been messing with several of the .NET DLL's that are going to make this much easier as well as hooking into Amazon, etc. from C#. It's looking much simpler than I first thought it might be, making this a promising possibility. The DLL that's useful for this particular functionality is the Tortuga.NET library, which actually does lots of useful stuff including reading RSS and posting to Metaweblog API engines.

I thought I'd share just how easy it can be to make a bare bones posting app that just has a few text boxes for entering the title and the raw HTML to the post and a few more for username/password and XMLRPC Url and a button for posting a draft and another for publishing.

From that framework here's all it really takes to post a draft entry into a Metaweblog API compatible engine like Wordpress.

string postId;
Tortuga.MetaWeblog mwlog = new Tortuga.MetaWeblog();
mwlog.Login = username.Text;
mwlog.Password = password.Text;
mwlog.ServiceUrl = xmlrpcurl.Text;
//The last parameter in NewPost is set to false to keep the post as a draft
postId = mwlog.NewPost("0", postTitle.Text, postBody.Text, false);
postTitle.Text = "";
postBody.Text = "";
MessageBox.Show("Posted as post: " + postId);

That's included in the sample project ZIP I put together to help others get started. To keep it quick and easy, the code is just duplicated for the publish or draft function instead of being properly abstracted into the single difference.

Download the basic blogging client


Weston Boyd on 6/23/2006
Hey, it's my photo :) An amusing google-find. Glad you like it.
Sanjeev Narang on 7/17/2006
Your blogging method posts to the default category; any way to change the category of the post ?? any DLL's that let you do that ??
Eric D. Burdo on 7/25/2006
Thank you for posting this. I am trying to build my own system for posting articles, and the only XMLRPC package I could find was giving me grief. I'll go try this one now...
Danies Pahlevi on 2/19/2007
Hi, i'm intresting with your example for c# client , could u extend the tutorial , coz it very good .. and btw is bloger api (gdata.client) from google is the same with tortuga ? thank's bye nice to know u
J Wynia on 2/20/2007
I probably won't extend this article. That's because the GData client and the Atom Publishing Protocol that it's based on are MUCH better API's for publishing online. Unfortunately, many of the tools on the server side aren't yet ready for it. GData/Atom is entirely different than the Metaweblog API.
Nitz on 6/2/2009
Hi.. Your code is very useful. But could you help me to get the recent posts from wordpress.
castle on 5/2/2009
hey man do you have the source code of TortugaDN.dll.
Alex Brown on 7/7/2009
Hi, I've developed a wrapper for the metaWeblog and Wordpress API: Available on Codeplex:
blog comments powered by Disqus
Or, browse the archives.
© 2003- 2015 J Wynia. Very Few Rights Reserved. This article is licensed under the terms of the Creative Commons Attribution License. Quoted content or content included from others is not subject to that license and defaults to normal copyright.