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:
- PowerShell 3.0 or higher
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
.
- How to find Sharepoint Guid of a list
- Get the List id (Guid) for a list by name in SP 2010 Programatically.
-
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'
This can BREAK YOUR SHAREPOINT INSTALLATION and will put it in the UNSUPPORTED STATE, use with EXTREME CAUTION!