Time and again, we are met with both new requirements and challenges. So it was recently. The task: migrate an entire SharePoint wiki to Confluence. Of course, there are also large, expensive and complex solutions for this. However, this is not always necessary! Let’s illustrate this in the following example.

After a short search the first hit. There is a very helpful Powershell tool from AtlassianPS. With the ConfluencePS module, it is easy to create Confluence Wiki pages by code.

Powershell is exactly the right means to an end. This has already proved its worth in other problems in the past. Automated solutions can be easily created.
For example, we’ve already reported how to change the Created/Modified Attributes created by O365 ShareGate when migrating to a FileShare, or how to convert Office documents from .doc to .docx on SharePoint.

Furthermore, Powershell has some advantages because the code is not compiled and is easily visible and adaptable.

So what are the necessary steps to transfer a SharePoint wiki to a Confluence Wiki? This can be summarized on 4 levels.

  1. SharePoint Wiki page.
  2. Replace SharePoint links with target links.
  3. Copy images from SharePoint to Confluence.
  4. Confluence Wiki page.

The automated creation of Confluence Wiki pages

The first or in this case last step has thus been taken. This is very easy to do using the following code Snippet:

New-ConfluencePage -Title 'MyNewWikiPage' -SpaceKey 'Wiki' -Body 'PageContents'

And now?
Of course, it is necessary to transfer the SharePoint wiki page to the Confluence Wiki page.
So, let’s read the SharePoint page content and then pass it to the ConfluencePS module as body text.

Fortunately, SharePoint stores all of the page content of a wiki page in the PublishingPageContentbox.
The format is shown in HTML tags. We use these respectively to replace hyperlinks and copy any existing images. Afterwards, you can create the Confluence Wiki page directly.

  1. First, you access the SharePoint element of the wiki page.
  2. You then read the corresponding PublishingPageContent field.
  3. This will ultimately create the new Confluence Wiki page.
$WikiBody = $PageItem["PublishingPageContent"]

New-ConfluencePage -Title 'SharePoint Wiki Page' -SpaceKey 'TechWiki' -Body $WikiBody | Out-zero

Et viol! The result of our migrated page

SharePoint Wiki Confluence Migration
SharePoint Wiki Confluence Migration

On the left is the SharePoint page. Right after that our new migrated Confluence Wiki page.

It’s as easy to migrate a SharePoint wiki to Confluence. In case of additional questions, we are of course at your disposal at any time with our knowledge.