Creating a Basic Metaweblog API Blogging Client in C#

Jun
15
2006

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

 

Comments on this post

Feedback is always welcome. Read some from other folks or leave your own below. Just keep things civil and remember that what you post lives on in public. Forever.

Thanks,
J

7 Responses to “Creating a Basic Metaweblog API Blogging Client in C#”

  1. Weston Boyd Says:

    Hey, it's my photo :)

    An amusing google-find. Glad you like it.

  2. Sanjeev Narang Says:

    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 ??

  3. Eric D. Burdo Says:

    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…

  4. Danies Pahlevi Says:

    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

  5. J Wynia Says:

    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.

  6. castle Says:

    hey man do you have the source code of TortugaDN.dll.

  7. Nitz Says:

    Hi.. Your code is very useful. But could you help me to get the recent posts from wordpress.

Leave Your Own Comment

By submitting a comment, you agree to license it under the terms of the Creative Commons Attribution license.

People who post comments get the added benefit of visiting the site without advertising.

© 2003-2009 J Wynia. All original content is licensed under the terms of the Creative Commons Attribution license unless otherwise noted. Content from other sources is licensed under its original terms.