Claymore edited this page Sep 13, 2010 · 8 revisions

SharpMediaWiki is yet another C# interface to the MediaWiki API. It was written as a replacement for heavy and slow DotNetWikiBot. The library provides convient interface for continuous property queries, enumerations, page creation / editing and moving. All queries return instances of XmlDocument class which can be searched with XPath.


You will need Microsoft .NET Framework 3.5 to compile and use the library on Windows. It can be also compiled with Mono 2.4 (at least MoMA didn’t report any problems).


SharpMediaWiki is licensed under the terms of the BSD License, see the included License.txt file.


Example usage:

using System;
using System.Xml;
using Claymore.SharpMediaWiki;

namespace Example
    internal class Program
        static void Main(string[] args)
            Wiki wiki = new Wiki("");
            // Login into as "Username".
            wiki.Login("Username", "Secret");
            // Load raw text of the page titled "Wiki".
            string pageText = wiki.LoadPage("Wiki");
            ParameterCollection parameters = new ParameterCollection();
            // We want page information and automatic resolving of redirects.
            parameters.Add("prop", "info");
            string[] titles = new string[] { "WikiNode", "WP:HELP" };
            // Make the query.
            XmlDocument xml = wiki.Query(QueryBy.Titles, parameters, titles);
            // Select redirect nodes.
            XmlNodeList redirects = xml.SelectNodes("/api/query/redirects/r");
            Console.Out.WriteLine(string.Format("Found {0} redirects.", redirects.Count));
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.