pnp / pnp/pnpframework

[BUG] Wiki Page Internal Links Missing "SitePages"

Open
#617 6 comments 0 reactions 1 assignee View on GitHub

@jansenbe is already working on this.

Since Mar 4, 2022.

area: page transformation 🦾 question
Dominant language
C#
Stars
259
Forks
161
Avg merge
10h 33m
Merged PRs (30d)
1

Description

Problem Area

[x] Page Transformation: Error during the use of page transformation from PnP PowerShell
[ ] Page Transformation: Error during the use of page transformation from .Net
[ ] Page Transformation: Page is not looking correct after transformation
[ ] Modernization Scanner: something went wrong...

Expected or Desired Behavior

I'm converting a Wiki library in SharePoint 2010 to SharePoint Online. Because I'm converting from SP2010, I'm using SharePointPnPPowerShell v 3.29.2101.0, which as I understand it is the last version which works with SP2010.
The files convert beautifully, though they are placed into a folder in the Site Pages library, as mentioned in pnp/pnpframework#626. The pages also aren't published in the destination.

Observed Behavior

The bug is with the links inside the pages. They aren't fixed up properly. The pages end up in a folder called Wiki, as that is the name of the source Wiki library.

  • Home.aspx is copied to: https://[tenant].sharepoint.com/sites/apps_CCR/SitePages/Wiki/Home.aspx
  • CCR Regional Expert List.aspx is copied to: https://[tenant].sharepoint.com/sites/apps_CCR/SitePages/Wiki/CCR%20Regional%20Expert%20List.aspx
  • etc.

So, the pages land in appropriate locations. But the lniks insode the pages are missing the SitePages part of the URLs:

  • Within CCR Regional Expert List.aspx , the link to Home.aspx is: https://[tenant].sharepoint.com/sites/apps_CCR/Wiki/Home.aspx
  • Within Home.aspx, the link to CCR Regional Expert List.aspx is: https://[tenant].sharepoint.com/sites/apps_CCR/Wiki/CCR%20Regional%20Expert%20List.aspx
  • etc.
Steps to Reproduce

My PowerShell looks something like below. I've tried every combination of the property settings (-Target*) I can think of to remedy this. I've also had @ToddKlindt take a look to make sure I'm not doing something dumb. Am I holding it wrong?

Import-Module -Name SharePointPnPPowerShellOnline

$sourceSiteUrl = "sourceSiteUrl"
$targetSiteUrl = "targetSiteUrl"
$sourceLibrary = "Wiki"

$sourceConnection = Connect-PnPOnline -Url $sourceSiteUrl -ReturnConnection -Credential (Get-StoredCredential -Target "Marc")
$targetConnection = Connect-PnPOnline -Url $targetSiteUrl -ReturnConnection -UseWebLogin

$wikiPages = Get-PnPListItem -Connection $sourceConnection -List $sourceLibrary -PageSize 500

$filteredWikiPages = $wikiPages | Select-Object -First 5

foreach ($page in $filteredWikiPages) {

    $targetPageName = $page.FieldValues.FileLeafRef

    Write-Host "Writing page <$($page.FieldValues.FileLeafRef)> to <$($targetPageName)>"

    ConvertTo-PnPClientSidePage `
        -Connection $sourceConnection `
        -Library $sourceLibrary `
        -Identity $page.FieldValues["ID"] `
        -Overwrite `
        -CopyPageMetadata `
        -TargetConnection $targetConnection `
        -TargetPageName $targetPageName `
        -LogType File -LogFolder .

}

p.s. Convert-WikiAndWebPartPages.ps1 doesn't seem to be all that tuned for Wiki pages. Most Wikis in older on premises versions are going to be in a separate library from SitePages.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.