How to extract all SharePoint List: List Settings - Column Formatting

Rowell, Vicki (Health) 20 Reputation points
2024-02-25T11:41:53.31+00:00

Hi there. I have 4 Teams channels and each have their own SharePoint List. Each list has 42 columns with different formatting applied. So that I can ensure all like-for-like columns across the 4 channels are the same, how can I extract what looks like JSON?? I have searched and searched, but no luck. Can't even find an obvious PowerAutomate template. https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting - great site, but nothing that shows me how to extract. Any help is much appreciated!

Microsoft 365 and Office SharePoint For business Windows
{count} votes

1 answer

Sort by: Most helpful
  1. Yanli Jiang - MSFT 31,596 Reputation points Microsoft External Staff
    2024-02-26T03:14:10.34+00:00

    Hi @Rowell, Vicki (Health), First, install the PnP PowerShell module on your computer.

    References: https://www.sharepointdiary.com/2021/02/how-to-install-pnp-powershell-module-for-sharepoint-online.html https://www.spguides.com/install-pnp-powershell/ Then run the following code to obtain the xml file of the list template.

    # Connect to SharePoint Online
    Connect-PnPOnline -Url https://yourtenant.sharepoint.com/sites/yoursite -Interactive
    
    
    # Get the list schema, including column formatting JSON
    Get-PnPSiteTemplate -Out .\ListSchema.xml -ListsToExtract "Your List Title" -Handlers Lists
    

    Replace https://yourtenant.sharepoint.com/sites/yoursite with the URL of your SharePoint site, and Your List Title with the title of the list you want to extract the column formatting JSON for. If you want to compare the differences between the four lists, you can run the above code for the four lists respectively, obtain different xml files, and then compare them. Remember to rename the ListSchema.xml file every time you run it.

    Reference:

    https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins-modernize/from-xslt-to-list-formatting#pnp-provisioning-and-json-formatting https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/introducing-the-pnp-provisioning-engine


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.