Nearly two years ago I wrote another blog on this topic and referred to a little application I had written to explore a CMP file that could also extract individual files from the CMP. Shortly after that, and before I could upload the app, the hard disk in my laptop died. I recovered most of the content of the drive, but had thought I had lost my Visual Studio directories. Guess what! I revisited that drive (I never throw things away…) looking for some old pictures and I found the missing app!
First go read the original article: Exploring SharePoint CMP Export Files. There you can see what’s in a CMP and how to manually extract the files.
To help understand the CMP Manifest file I wrote a small .Net program to list the SPObject elements and a handful of attributes from each one.
The first step is to open the CAB file and extract the Manifest.xml file. As I have always been amazed at the features found in the .Net libraries, I figured I would find a CAB extractor library in the Framework. Turns out there was one in the one of the Betas, there is not there now. (There is a Zip library though!) So I ended up using the CAB extractor found in Windows, extrac32.exe. (For details type “extrac32 /? | more” at the command prompt.) So within the app I used System.Diagnostics.Process to run extrac32 to extract the files. The Manifest.xml file is then loaded into an XmlDocument object, parsed into a DataTable and then displayed in a GridView.
The List Content button extracts the manifest.xml file from the CMP file and then extracts some of the descriptive content of the manifest file to display a fair amount of detail in the GridView. The manifest documents EVERYTHING about the site, so I added some checkboxes to filter the display.
- Files Only – well… only displays manifest entries about files (including ASPX, master pages, and other non-content files)
- Exclude ASPX – hides ASPX files (in the next update I’ll have it hide all non-content files)
- Include List Items – I hid list content as a default as most of the interesting stuff is in the XML and is different for each list type. If you check this box then all list items are added to the grid. You can check scroll to the right and click in the XML column to see the full XML description of the list item.
Extract All Files extracts all of the files, then renames them and puts them into a SharePoint-like directory structure. Note that this example has three subsites in the backup.
The extracted files are where you would expect them to be, Shared Documents in this example, and still have their correct Date Modified:
Extract Selected extracts individual files to any location you pick. To select a file click the “selectors” at the left of each row. To select multiple files use the normal click, shift-click, ctrl-click techniques.
I will probably most this into CodePlex.com, but for now you can download it from here:
EXE only: download (9k)
Project zip: download (107k)