none
Import-SPWeb fails wth modern list

    Question

  • Hi,

    I've ran into an issue with modern lists and Granular backup/restore procedure:

    I've made a granular backup of a modern list using the central admin portal, and I'm trying to restore it with the Import-SPWeb cmdlet now.

    However, the cmdlet fails with an error "The element 'WebPart' in namespace 'urn:deployment-manifest-schema' has invalid child element 'ColumnWidth' in namespace 'urn:deployment-manifest-schema' ...".

    It seems that the Import-SPWeb cmdlet has not been updated to support some modern lists' features (namely saving and modifying the column widths), or am I missing something here?

    Wednesday, January 30, 2019 1:36 PM

All replies

  • Does your list has any customization applied like Column Formatter?

    Regards, Nanddeep Nachan


    Thursday, January 31, 2019 6:14 AM
  • OK, this gave me an idea to investigate further.

    If I try the export-import procedure with an empty new list, the error doesn't show up until I resize the columns and save the view. The column formatting is exported and imported just fine.

    So any ideas for a workaround? I could export without the column width data and just recreate it manually. However, I'm not sure if its possible to erase the width data from a view once it's been set.

    Thursday, January 31, 2019 10:20 AM
  • Hi,

    Please try by setting the width using JSON at source and then backup/restore.

    Below JSON code will help to set column width:

    {
    	"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
    	"elmType": "div",
    	"txtContent": "@currentField",
    	"style": {
    		"width": "100%",
    		"white-space": "nowrap"
    	}
    }


    Regards, Nanddeep Nachan

    Friday, February 1, 2019 10:06 AM
  • OK, I guess this would work as a workaround.

    However, I did not find a way to remove column width data once it has been set on a list. So basically this makes the list impossible to export/import once the column widths have been saved (using the "normal" way). That's certainly an annoying limitation.

    Monday, February 11, 2019 6:22 PM