Extracting Artifacts Created with SharePoint Designer and the Browser

You can use either SharePoint Designer or the browser to create and customize SharePoint Web sites. These authored artifacts are stored in the content database. If you choose, you can extract them from the content database to file representations and manage them as solution artifacts in version control. This topic explains how to extract the following artifacts:

  • Site columns and content type definitions
  • Files and modules
  • List workflow associations

There are existing tools and techniques for site columns, content type definitions, files, and modules. For more information, see the following:

You can extract list workflow associations with Windows PowerShell.

Extracting List Workflow Associations from the Content Database

You can determine list workflow associations by traversing the SharePoint object model. The following procedure describes how to do this.

To determine list workflow associations

  1. Determine the URL of the site collection.
  2. Construct an SPSite object.
  3. Iterate through each Web site in the site collection with the SPSite.AllWebs method.
  4. Iterate through each Web site's lists with the SPWeb.Lists method.
  5. Iterate through each list's workflow associations with the SPList.WorkflowAssociations method.

The following Windows PowerShell script iterates through all workflow associations and displays the workflow association's SoapXml property.

if ($args.Count -eq 0)
write-host "siteurl parameter is missing. Please provide the Url of a site collection as a parameter" -foregroundcolor red -backgroundcolor black

Function Show-WorkflowAssociation($workflowassociation) { 
write-host "Web: "  -nonewline; write-host $_.ParentWeb.Url
write-host "List: "  -nonewline; write-host $_.ParentList.Title; 
write-host "Soap Xml:"; write-host $_.SoapXml


$mysite=new-object Microsoft.SharePoint.SPSite($args[0]) 

$mysite.Allwebs | foreach { $_.Lists | foreach { $_.WorkflowAssociations | foreach { Show-WorkflowAssociation($_) } } }

You can adapt this technique to extract other values that are exposed through the SharePoint object model.

Home page on MSDN | Community site