Import/Export SharePoint from/to the filesystem
THIS is invaluable. We are having to re-install our SharePoint server because of the way it’s installed on a server that is low on disk space. Unfortunately, SP was installed to the second partition, so I can’t really use parititioning tools to make more space available to the system partition without hosing my SP installation. So, the tools needed:
SPIEFolder
http://spiefolder.codeplex.com/
I include a download from my site, because I know that notoriously, these software authors replace it with something new eventually, and latest isn’t always greatest. So here it is, archived for your downloading pleasure. However, for now you can download from the author’s site so that you know you are getting a valid copy. I don’t tamper with any of the files I upload, but this site was originally intended for myself, so I can repeat procedures and have all the files and steps available in one place.
I was initially needing to export my SP installation to the file system, so this is the syntax I used:
spiefolder http://localhost “My Folder” c:\SharePoint
This did NOT work, and I’ll tell you why. The URL it is looking for is the full URL. This results in the error:
Value does not fall within the expected range.
I also struggled with the error:
The server instance specified was not found. Please specify the server’s address and port.
This error was easily resolved by adding a host header in IIS according to MS article at http://support.microsoft.com/?kbid=832816.
I had to export using the full URL as I mentioned above:
spiefolder http://localhost/sites/admin “My Folder” c:\Sharepoint
So how did I get the full URL? That’s a good question. I have many sites, 252 sites to be exact, that needed exporting. In order to reveal this list, I used the SQL query tool and used this query against the local SITE database. The query is:
SELECT DISTINCT ‘http:///’ + W.FullUrl AS URL, L.tp_Title, L.tp_BaseType, W.FullUrl
FROM dbo.Lists L INNER JOIN
dbo.Webs W ON W.Id = L.tp_WebId
WHERE (L.tp_BaseType = ‘1′) AND (L.tp_Title NOT LIKE ‘%Gallery%’) OR (L.tp_BaseType = ‘5′)
This results in several columns, and we’re only interested in the first two. Select the column and copy/paste it into Excel. Replace http:/// with http://localhost/ for the URL column. For the title column, do the same, copy paste to Excel. I inserted columns before and after this and added the quotation mark “, and used the concatenate function to get the desired result. In fact, using concatenate a couple of times, I was able to build my entire script, by adding a column at the beginning like “c:\spiefolder\spiefolder” and a trailing column for the destination with spaces in places to develop the complete command line:
c:\spiefolder\spiefolder http://localhost/path/to/site “My Documents” c:\Sharepoint
Since I had 252 entries, my script read like this over and over 252 times. Works well, so I scheduled it to run daily up to the point that we switch over. Only took about 15 minutes or so to export around 5 GB of documents.
SELECT DISTINCT 'http:///' + W.FullUrl AS URL, L.tp_Title, L.tp_BaseType, W.FullUrl
FROM dbo.Lists L INNER JOIN
dbo.Webs W ON W.Id = L.tp_WebId
WHERE (L.tp_BaseType = '1') AND (L.tp_Title NOT LIKE '%Gallery%') OR (L.tp_BaseType = '5')
No Comments »