Ok so this is for my notes really… (and for anyone who is interested in having to migrate from SharePoint 2007 based technology!)
So our hosted service provider won’t give us a .spb file (I have no idea why!). In addition to this their advice is to use webdav. Great for copying a single document maybe.. not for performing a migration or archive copy. To make matters worse still we have no central admin access so I can’t use a native backup.
So we rock in with either the following:
- SharePoint Web Services using custom code (c#) – long
- SharePoint Designer 2007 – create a backup to .cmp (nice and easy)
- Buy a third party product to to option 1
So looking at the “no” cost route I attempt touse SP designer to backup the site – this reports as a success however there appears to be a bug (see http://objectmix.com/sharepoint/722333-sahrepoint-designer-restore-cmp-file-fail.html)
So to resolve this, we run a backup using sp designer 2007, we then log into the site, restore the .cmp files in the recycle bin, then navigate to the root of the site and copy all .cmp files. Then once we have all of these we can use the following command: copy /b *.cmp <backup.cmp> to create a single file.
Excellent we then could use SP designer to restore this into an on-prem VM running SharePoint 2007. Cool, but I would rather not restore to SharePoint. So I started to look at other options… it turns out a .cmp file is a cab. The cab file holds a bunch of dat files and a series of xml files. Now using a text editor and say 7zip we could search the manifest.xml and locate a single file or library and rename the .dat to the correct filename. This seems a bit long winded and isn’t fir for purpose with my task. So I browse the web to find http://techtrainingnotes.blogspot.co.uk/2010/01/sharepoint-exploring-sharepoint-cmp.html
This guy has created some code to extract this.. the problem with this is that it relies on the following function which no longer works (I’m running Win8)
private int DoExtract(string cmd)
// run extrac32.exe to open a CAB file.
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = “extrac32″;
proc.StartInfo.Arguments = cmd;
So we can override this by extracting the files manually using 7zip into the required location. Now I’m seeming to be missing a few files at present, I’m going to retry this process and see how I get on, I may have just missed something!…
Ok so I resolved the missing file error, in the code we had:
In relation to the other code I couldn’t quite work out why this was here, it seems there was a temporary extraction so I’m assuming that it was to delete the scratch files – whatever the reason was I commented that out. The other problem I had was file/path length exceeding the NTFS limits.
So I thought I would try something quick and dirty for the time being:
string path = exportPath + @”\site” + r[“Url”].ToString().Replace(“/”, “\\”);
path = path.Replace(r[“Name”].ToString(), “”);
//need to make the path shorter! – DC
path = path.Replace(” “, “”);
System.IO.File.Move(exportPath + @”\” + r[“FileValue”].ToString(), path + r[“Name”].ToString());
as you can see I took out any white space in the destination path. The file’s are still as they were as I haven’t touched the “Name” string.
So after many hours I now believe I can at least snapshot the current SP site and if required, restore using SharePoint designer or at least extract the data.