0

Is there a way to export or backup the column formatting JSON that has been applied to SharePoint list columns?

Obviously, column formatting is so useful that it is often applied to lots of lists, and in dynamic environments the values change often.

Apart from manually copying and pasting the JSON values for each column in each list into a JSON file, is there a way to export or backup column formatting JSON values?

2
  • Are you trying to export the JSON itself? Jul 22, 2021 at 4:46
  • My understanding is that column formatting for each column is contained in one JSON object with multiple properties. (Similarly, each customised Layout view is a JSON object). So if I have a SharePoint list, and 5 columns have column formatting, there would be 5 JSON objects. (If I also modified Gallery view, there would be another JSON object). So any method that simplifies retrieving all JSON objects associated with a list (eg as an 'export' or 'backup') would be great. As long as it is clear which JSON is associated with which List, Column, View etc, I think any method is fine. Jul 22, 2021 at 5:17

2 Answers 2

2

You can get the JSON code applied to column formatting using PnP PowerShell like:

$field = Get-PnPField -List "JSONFormatting" -Identity "Status" -Includes Title,CustomFormatter
$field.CustomFormatter

Output:

enter image description here


You can also get the JSON using SharePoint REST API like:

<siteUrl>/_api/Web/Lists/getByTitle('JSONFormatting')/fields?$select=Title,CustomFormatter

Output:

enter image description here


For list views: Use below endpoint:

<siteUrl>/_api/Web/Lists/getByTitle('JSONFormatting')/views/getbytitle('All Items')?$select=Title,CustomFormatter

You can change the view name as per your requirements.

6
  • I'm sure this answer will be very helpful to someone (and me in another environment), but in locked down corporate environment, is there way to do this without PnP PowerShell? I am Owner of Microsoft Teams teams and SharePoint sites, but that is as far as my permissions go. When I tried to use Connect-PnPOnline -Url "https://my-tenant.sharepoint.com", I got Connect-PnPOnline : ********: The user or administrator has not consented to use the application with ID '****-****-****-****-****' named 'PnP Management Shell'. Send an interactive authorization request for this user and resource. Jul 22, 2021 at 5:27
  • 1
    Will you able to use SharePointOnlinePowerShell? Jul 22, 2021 at 6:38
  • It seems to also require admin level account to run anything, I installed with Install-Module -Name Microsoft.Online.SharePoint.PowerShell -Scope CurrentUser and it seemed to install but I cannot connect with anything like Connect-SPOService -Url https://contoso-admin.sharepoint.com -Credential [email protected] Jul 22, 2021 at 7:57
  • 1
    If you are able to use SharePoint REST API, check my updated answer. Jul 22, 2021 at 8:11
  • 1
    Yes, because the REST endpoint /fields is for the columns in SharePoint list & not for list views. Check updated answer for list views endpoint Jul 22, 2021 at 9:06
1

you can try this tool that allows you to export SharePoint lists to JSON, XML, Collections Power Apps and more.

https://export-list-sharepoint.web.app/ enter image description here

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.