RSS

How to Export a Link Map

This blog post shows how to export a file that maps Confluence links to SharePoint links.

When migrating pages from Confluence to SharePoint WikiTraccs makes sure to transform links as well.

Links between Confluence pages will become links between SharePoint pages.

When you change Confluence links in external systems to SharePoint links it might be handy to have a link mapping file that - for each old Confluence page link - shows the new SharePoint page link.

This post shows how you can generate such a link mapping file using a PowerShell script.

Outline

You’ll use a PowerShell script to create the link mapping file. A sample PowerShell script is available in the library.

Running the PowerShell script requires PowerShell 7 to be installed. Furthermore, the PnP.PowerShell module must be installed.

The PowerShell script connects to SharePoint Online and needs an Entra ID Application Registration Client ID for that. You already have such a client ID if you are migrating pages with WikiTraccs. You can use the same client ID that you enter in the blue WikiTraccs window.

In a minute, you’ll run a script that processes the metadata of all migrated pages in a SharePoint site collection and calculates the original Confluence links from this metadata.

Download the Wiki Transformation Project libray as zip file:

Unzip the file you downloaded. (Note: You could also use Git to clone the repository.)

Open scripts/post-migration/create-link-mapping/CreateLinkMapping.ps1 and adjust the parameters at the top of the script, mainly the client ID and the site collection URL.

Run the PowerShell script.

A new browser tab will open, prompting you to authenticate with Microsoft 365. This is required for the PowerShell script to read page metadata from the Site Pages library.

After authenticating the script should show console output for each page it processes, which could look like on the following image:

The link mapping result is written to a text file called linkmapping.csv which is stored to the current directory.

The content looks like this:

"SharePointPageLink","PageTitleLink","PageTitleLinkAlt","PageIdLink","PageTinyLink"
"/sites/migtarget1/SitePages/TM-Page-S1---Code-Snippet-106070257.aspx","http://localhost:8090/wiki/display/TM/Page+S1+-+Code+Snippet","http://localhost:8090/wiki/pages/viewpage.action?spaceKey=TM&title=Page S1 - Code Snippet","http://localhost:8090/wiki/pages/viewpage.action?pageId=106070257","http://localhost:8090/wiki/x/8YBSBg"
"/sites/migtarget1/SitePages/TM-Page-S6---Table-Cell-Colors-110464825.aspx","http://localhost:8090/wiki/display/TM/Page+S6+-+Table+Cell+Colors","http://localhost:8090/wiki/pages/viewpage.action?spaceKey=TM&title=Page S6 - Table Cell Colors","http://localhost:8090/wiki/pages/viewpage.action?pageId=110464825","http://localhost:8090/wiki/x/OY_VBg"
"/sites/migtarget1/SitePages/TM-Page-S2---Page-Tree-183861249.aspx","http://localhost:8090/wiki/display/TM/Page+S2+-+Page+Tree","http://localhost:8090/wiki/pages/viewpage.action?spaceKey=TM&title=Page S2 - Page Tree","http://localhost:8090/wiki/pages/viewpage.action?pageId=183861249","http://localhost:8090/wiki/x/AYD1Cg"

Using Confluence page title, page ID, and tiny link (all migrated by WikiTraccs) the script calculated possible Confluence links, as those link types are known and follow a common scheme.

The script creates the most common Confluence (on-prem) link types: title link, pageId link, and tiny link.

The script connects to a single site collection at a time. Reconfigure and run this for every site collection you need the link map for. Or extend the script to take care of that and merge the mapping files.

Wrap

In this blog post we looked at how we can use migrated page metadata and a PowerShell script to create a mapping file that maps Confluence page links to the new SharePoint page links.

This can be helpful, for example, when searching and translating Confluence links in third-party systems.