Announcing MetaWeblogSharp - a Simple .NET MetaWeblog Client Library  
Sunday, January 20, 2013 at 11:34AM
saveenr

While trying to track down an issue with Squarespace 5's implementation of the MetaWeblog API I needed to create an MetaWeblog client to help track down the issue. I couldn't find a simple one with no dependencies so I created one: MetaWeblogSharp

This is a very simple library! It is lightweight and has no dependencies on any other library. It even implements its own XMLRPC stack.

You can get the source from the CodePlex project: http://metaweblogsharp.codeplex.com/

Or you can download the binary via NuGet: https://nuget.org/packages/MetaWeblogSharp

Here's a simple example of the API in action:

 

// Create a client

var client = new MetaWeblogSharp.Client(blog_metweblog_url, blogid, username, password);

 

// Get a list of posts

var posts = client.GetRecentPosts(10);

 

// get a specific post

var post_1 = client.GetPost(postid);

 

// upload a media object

var bytes = System.IO.File.ReadAllBytes("test1.png");

var mo = client.NewMediaObject("foo.png", "image/png", bytes);

 

// create a new post

var categories1 = new List<string> { "A", "B", "C" };

var new_post_id = client.NewPost(title, body, categories1, true);

 

 

 

Article originally appeared on viziblr (http://viziblr.com/).
See website for complete article licensing information.