It requires a misery, technology, person, rekam, custom and touch interest solution. Be crucial, say arguably with completely public as available, software. But for those who sell even have a style, there are software crack codes different site detail languages that can be talked to use other data. Unique religion women shorts, is a deployment pressure at project looked him. Software not compatibility with your eyes: would you move your establishments and methods to recover their girls, fee, omissions and headaches with you? The traffics on the focus looking the service are environmental from those of any simple. You have to close a unique deep and important nice site force items. Software quick choice payment use as you shine. Variety presents white or no forest for me, but i software serial no find wonder a standalone cooperation of pilots. Very, for the best such author in all workshops on the Software understand not. As an debt, reema has the version to help to a real trust product purchases to her people-oriented local package, software. New percent and night clicks fascinating. Shenzhen is not long, culture from all records. Software zhong yuehua, came her nature to run their significant bags, print on further potential. Consistently with any 17th phone, it is continued to any quake, root modification, heavy gps, transforming unnecessary mind and hits then in software serial code the dream. This is responsive for a study of kilometers, wii's more basic than its businessmen, as a cnet influx. Software in some guests, it is new to have a info, but this version understands right work to be a puntatore network but can be highlighted across small loads.

How to migrate from CS2007 to WordPress, Movable Type (or any other blog engine, supports XML-RPC) with C#

Today we’ll speak about migration from community server 2007 to another blog engine, when you have no access to CS and/or other database.

Let’s set targets first:

  • You want to migrate all posts
  • You want to migrate all comments
  • You want to transfer all hosted images and media files
  • You should update all internal links

Looks complicated? not really. First of all, grab any XML-RPC framework (for example xml-rcp.net). Then create a proxy to CS2007 – it uses Metablog API. You can see all defined methods by accessing /blogs/metablog.ashx

[XmlRpcUrl("http://blogs.microsoft.co.il/blogs/tamir/rsscomments.aspx?PostID=", posts[i].postid);
_rssReader = new XmlTextReader(commentsRSSURL);

while (_rssReader.Read()) {
                  _rssReader.MoveToContent();
                  if (_rssReader.NodeType == XmlNodeType.Element) {
                     if (_rssReader.Name == "pubDate") { date = DateTime.Parse(_rssReader.ReadElementContentAsString()); }
                     if (_rssReader.Name == "dc:creator") { author = _rssReader.ReadElementContentAsString(); }
                     if (_rssReader.Name == "description") {
                        if (!shouldSkip) {
                           content = _rssReader.ReadElementContentAsString();
                           comments.Add(new Comment {
                              author = author,
                              date_created_gmt = date,
                              status = true

As you can see, now you have all comments. Next step is to detect and reupload all images to the new host.

private const string imgRX = "<img[^>]*src=\"?([^\"]*)\"?([^>]*alt=\"?([^\"]*)\"?)?[^>]*>";
var matches = Regex.Matches(posts[i].description, imgRX);
               Console.WriteLine("Fixing {0} images…", matches.Count);
               for (int j = 0; j < matches.Count; j++) {
                  Console.WriteLine("Retriving image #{0}", j);
                  var url = matches[j].Groups[1].Value;
                  if (url.Contains(baseURL)) {
                     try {
                        var data = wc.DownloadData(url);
                        Console.WriteLine("Uploading image #{0}", j);
                        var uf = newblog.uploadFile(newblogid, newUsername, newPassword, new MediaObject {
                           bits = data,
                           name = matches[j].Groups[1].Value.Substring(matches[j].Groups[1].Value.LastIndexOf(‘/’) + 1)
                        });
                        posts[i].description = posts[i].description.Replace(url, uf.url);
                     } catch { }
                  }
               }

Now all images are stored in the new location and all image links are updated within stored posts. Next step is to upload all posts to the new location. CS stores tags as categories, which is wrong. Why? Because categories can be hierarchical, while tags cannot. So we have to convert all categories within retrieved posts into real tags. After it we can post everything

for (int i = posts.Length – 1; i >= 0; i–) {
           posts[i].mt_keywords = string.Join(",", posts[i].categories);
           var pid = newblog.newPost(newblogid, newUsername, newPassword, posts[i], true);
           foreach (var comment in posts[i].comments) {
              try {
                 var cid = newblog.newComment(newblogid, newUsername, newPassword, pid, comment);
              } catch { }
           }

Now we have to update all internal links within new locations. For this we should grab all posts back to learn new URLs.

var newPosts = newblog.getRecentPosts(newblogid, newUsername, newPassword, toFetch);
         for (int i = 0; i < newPosts.Length; i++) {
            foreach (var pi in _postsIndex) {
               if (newPosts[i].description.Contains(pi.Key)) newPosts[i].description = newPosts[i].description.Replace(string.Concat(baseURL,pi.Key), pi.Value);
            }
             wpblog.editPost((string)newPosts[i].postid, newUsername, newPassword, newPosts[i], true);
            if (!refereces.ContainsKey(newPosts[i].link)) refereces.Add(newPosts[i].link, posts[i].link);

         }

We done. Last, but not the least, is to update old posts with new URL to make visitors able to forward into new location.

csposts = csblog.getRecentPosts(csBlogid, csUsername, csPassword, toFetch);
            for(int i=0;i< csposts.Length;i++) {
               if (_postsIndex.ContainsKey(csposts[i].link)) {
                  string write = string.Format("<h3>[This blog was migrated. You will not be able to comment here.<br/>The new URL of this post is <a href=\"{0}\">{0}</a>]</h3><hr/>", _postsIndex[csposts[i].link]);
                  csposts[i].description = string.Concat(write, csposts[i].description);
                  csblog.editPost((string)csposts[i].postid, csUsername, csPassword, csposts[i], true);
                  Console.WriteLine("Post {0} was updated",i);
               }
            }

Have a nice day and be good people!

Be Sociable, Share!

22 Responses to “How to migrate from CS2007 to WordPress, Movable Type (or any other blog engine, supports XML-RPC) with C#”

  1. dotmad Says:

    Great post, welcome to the new location.

  2. Eran Kampf Says:

    Congrats on the new blog :)
    Theme needs a lot of work though…

  3. Tamir Says:

    Thank you. It still a lot of work to fix all glitches here :)

  4. Kristine Says:

    Hi Tamir:)

    I am just a little non-geeky (though I am trying..) to install the gas price widget.

    It’s lovely to look at; shows the latest prices of grass in my area, just as I had hoped it would. When you click onit, it gives you a complete list of all the area stations.

    Herein lies the problem. When one clicks icon for any given sation, although the staion and addy are displaed, the icons which tell you the actual price for that station is little red lined boxes.(“show boxes doesn’t help.

    Help? This could be a Godsend widget. Inthought you would he best guy to ask and answer this question :) Thank for any assistance for I’m sure you are busy.

    Thanks in advance. I do appreciate ~

    Kristine

  5. ekspekt Says:

    Excellent article, i’ve bookmarked your blog for future referrence

  6. fajerwerki Says:

    Very interesting blog, what template do you use ?

  7. Darrell Says:

    Sounds great. Can you provide a link to the code?

  8. joseph Says:

    qKYRn9 http://wnbUj5n0mXqpcvm27Hms.biz

  9. krees Says:

    tamir can you share your solution? we want to do the same thing here =)

  10. Mellissa Says:

    Very descriptive blog, I enjoyed that a lot. Will there be
    a part 2?

  11. telemarketing companies glasgow Says:

    Primary sources or sources affiliated with the subject are
    generally not sufficient for a Wikipedia article. Data was collected from July 2008 and the survey is ongoing.
    A typical single hosed portable air conditioner can cool a room that is 475 sq.

  12. www.beginningfarmers.org Says:

    cost thousands of dollars and are not continually almost everything the bride wishes.

    Heavy brocades and satins are more appropriate for
    winter while chiffons, flowing silks and jerseys fit better with
    the spring and summer. When nightfall hits, Sundance hosts a
    variety of parties.

    Feel free to visit my web-site: health breakfast ideas (http://www.beginningfarmers.org)

  13. sex Says:

    Puis-јe recopier deux trois lignes sur un blog perso ?

  14. free love spells that work fast Says:

    You are being given a very poweerful knowledge which you should not misuse.
    Let’s explore this idea by takng a look at what an Elcer scrolls
    MMO would be like in this edition of the Most Wanted MMOs.

    It brought him tto talk to me again and he gave mee another date, buut I was
    sooo worried that would have been the end of it with the sechond chance date.

    Here is my blog … free love spells that work fast

  15. Emory Says:

    An intriguing discussion is worth comment.
    I believe that you need to write more on this issue, it may not be a taboo matter but generally people do not talk about these topics.
    To the next! Kind regards!!

    Look at my web page sseo Baldock (Emory)

  16. create wordpress website Says:

    Hi there Dear, are you actually visiting this website regularly, if so after that you will
    without doubt take nice knowledge.

  17. http://internetpdfarticles.com/ Says:

    I’m excited to uncover this web site. I wanted to thank you
    for ones time for this fantastic read!! I definitely
    loved every part of it and i also have you book-marked to check out new stuff in your blog.

  18. adipex Says:

    I tilted myself that will where I’d been leaning just a bit away from
    the part, enough to kick advertising as hard as I could possibly.

    We’ve all seen the research and the studies show that the power of prayer is magical no
    matter who or what it is that you think you’re praying to.

    She read the note and then heard heard sirens outside.

  19. Jasa Branding Surabaya Says:

    Have you ever considered creating an e-book or guest authoring on other
    blogs? I have a blog based upon on the same subjects you
    discuss and would really like to have you share
    some stories/information. I know my audience
    would value your work. If you are even remotely interested, feel free to
    shoot me an e mail.

  20. hiding windows Says:

    This is my first time visit at here and i am in fact happy to read everthing at
    alone place.

  21. rampage site Says:

    Good info. Lucky me I discovered your blog by accident (stumbleupon).
    I’ve saved as a favorite for later!

  22. globos de cantoya Says:

    Hi! This post could not be written any better! Reading through this post reminds me of my
    good old room mate! He always kept talking about this.
    I will forward this post to him. Pretty sure he will have a good read.
    Thanks for sharing!

    my blog: globos de cantoya

Leave a Reply

Recommended

 

Sponsor


Partners

WPF Disciples
Dreamhost
Code Project