0

I'm using PnP PowerShell cmdlet "ConvertTo-PnPPage" to migrate from SPO Classic Intranet to a modern communications site in the same tenant. In some of my page transformations, I'm getting some unexpected URLs. Specifically, I'm seeing URLs with ".../sites/sites/..." and in some cases ".../sites/sites/sites/..." and I can't determine why the URLs are being rewritten this way. I have an additional 700+ pages to transform and would like to understand this process and adjust.

Thanks to all on the PnP team for all their hard work!

Sample source page link URL in page content

/Accounting/Accounting%20and%20Administrative%20Services%20Documents/Accounting%20Coordination%20Agendas.xlsx

URL in transformed page content (notice the .../sites/sites/...)

https://redactedclientname.sharepoint.com/sites/sites/accounting/Shared%20Documents/Accounting%20Coordination%20Agendas.xlsx

Excerpt from URL Mapping file ("Accounting" URL mapping)

https://redactedclientname.sharepoint.com/Accounting/Pages/, https://redactedclientname.sharepoint.com/sites/accounting/SitePages/

https://redactedclientname.sharepoint.com/Accounting/Accounting%20and%20Administrative%20Services%20Documents/, https://redactedclientname.sharepoint.com/sites/accounting/Shared Documents/

https://redactedclientname.sharepoint.com/Accounting/Accounting and Administrative Services Documents/, https://redactedclientname.sharepoint.com/sites/accounting/Shared Documents/

https://redactedclientname.sharepoint.com/Accounting/, https://redactedclientname.sharepoint.com/sites/accounting/

/Accounting/Pages/, /sites/accounting/SitePages/

/Accounting/Accounting%20and%20Administrative%20Services%20Documents/, /sites/accounting/Shared Documents/

/Accounting/Accounting and Administrative Services Documents/, /sites/accounting/Shared Documents/

Command Used (PnP PS Ver 1.5)

ConvertTo-PnPPage

-Identity "redactedPageName.aspx"

-KeepPageCreationModificationInformation

-PageLayoutMapping "C:\dev\temp\redactedclientname\pageTransformDefault.xml"

-PublishingPage

-RemoveEmptySectionsAndColumns

-SkipHiddenWebParts

-SkipItemLevelPermissionCopyToClientSidePage

-TakeSourcePageName

-TargetWebUrl "https://redactedclientname.sharepoint.com/sites/projectbilling/"

-WebPartMappingFile "C:\dev\temp\redactedclientname\webpartmapping.xml"

-UrlMappingFile "C:\dev\temp\redactedclientname\urlMapping1.csv"

-UserMappingFile "C:\dev\temp\redactedclientname\userMappingFile.csv"

-SummaryLinksToHtml

-Overwrite

–LogType Console

1 Answer 1

0

I had a similar issue. Below is the command that worked for me. Note the last two parameters SkipDefaultUrlRewriting and ClearCache.

I also had to mention every possible combination of URL mappings on my CustomURLMapping.csv

ConvertTo-PnPPage -Identity $pageName -PublishingPage -TargetWebUrl $targetSiteUrl -PageLayoutMapping "PRODMapping.xml" -TargetPageName $targetPageName -OverWrite -UrlMappingFile "CustomURLMapping.csv" -SkipDefaultUrlRewriting -ClearCache 
1
  • Ah, I see, by skipping default you would have to define all variations. Did you try with just using -ClearCache?
    – Arknev
    Oct 22, 2021 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.