/WssCompressedStructure

PowerShell module to get/set XML Schema and Content Types for SharePoint list directly in the content database.

Primary LanguagePowerShellMicrosoft Public LicenseMS-PL

Build status

WssCompressedStructure PowerShell module

This module allows you to get/set XML Schema and Content Types for SharePoint list directly in the content database.

See this blog post for more details:

Requirements

  • PowerShell 3.0 or higher

Quick how-to:

This example shows how to modify XML Schema for list with ID cff8ae4b-a78d-444c-8efd-5fe290821cb9, which is stored in SharePoint content database SP_CONTENT on server SQLSRV.

Finding list GUID:

Using module

  • Download module as Zip (unblock zip file before unpacking) or clone this repo using Git

  • Import module: Import-Module -Path 'X:\Path\To\WssCompressedStructure\Module'

  • Backup XML Schema blob for SharePoint list to file:

      Get-SpListWssCompressedStructure -ServerInstance SQLSRV -Database SP_CONTENT -Fields -ListId 'cff8ae4b-a78d-444c-8efd-5fe290821cb9' | Export-WssCompressedStructureBinary -DestinationPath 'X:\Wss\'
    
  • Export XML Schema for SharePoint list to file:

      Get-SpListWssCompressedStructure -ServerInstance SQLSRV -Database SP_CONTENT -Fields -ListId 'cff8ae4b-a78d-444c-8efd-5fe290821cb9' | Expand-WssCompressedStructure -DestinationPath 'X:\Wss\'
    
  • Modify file cff8ae4b-a78d-444c-8efd-5fe290821cb9.xml to your needs

  • Update XML Schema in database for this list:

      New-WssCompressedStructure -Path 'X:\Wss\cff8ae4b-a78d-444c-8efd-5fe290821cb9.xml' | Set-SpListWssCompressedStructure -ServerInstance SQLSRV -Database SP_CONTENT -Fields -ListId 'cff8ae4b-a78d-444c-8efd-5fe290821cb9'
    
  • If something goes wrong, restore XML Schema from blob:

      'X:\Wss\cff8ae4b-a78d-444c-8efd-5fe290821cb9.bin' | Import-WssCompressedStructureBinary | Set-SpListWssCompressedStructure -ServerInstance SQLSRV -Database SP_CONTENT -Fields -ListId 'cff8ae4b-a78d-444c-8efd-5fe290821cb9'
    

WARNING:

This can BREAK YOUR SHAREPOINT INSTALLATION and will put it in the UNSUPPORTED STATE, use with EXTREME CAUTION!

Details: