Friday, March 20, 2009

Moving Sites with SharePoint designer

********NOTE THIS IS FOR SPD 2007  for MOSS 2007/WSS 3.0 sites********
Recently I had to do a dry run of moving a SharePoint site using SharePoint Designer. I've outlined the steps below based on the Microsoft recomendations:

Backing up a Web site using SharePoint Designer creates a content migration package, or .cmp file. When you back up a Web site, you can choose to back up either the top-level Web site or the top-level Web site and any subsites. The backup file that you create includes list or library content, security settings, user information, navigation, customizations, and personalizations (such as views, site templates, and content types). The backup file does not include workflows, alerts, and properties stored at the site collection level.
To back up a site, you must have administrator permission for that site at all levels, but you do not require administrative access to the server that is running Windows SharePoint Services 3.0.
1. Open SharePoint Designer, on the File menu, click Open Site.
2. In the Open Site dialog box, browse to http://sharepointsite.net/site and click the Web site that you want to back up, and then click Open.
3. On the Site menu, point to Administration, and then click Backup Web Site.
4. In the Backup Web Site dialog box, to include all subsites of the current Web site in the backup, select the Include subsites in archive check box.
5. Click Advanced, enter http://sharepointsite.net/site/temp, and then click OK. This is to allow the temporary files to reside on the server until the main .cmp file can be created.
6. In the Backup Web Site dialog box, click OK.
7. In the File Save dialog box, select the location where you want to store the .cmp file, locally on a Computer
8. In the File name box, type the name for the file, (Ex: Site_031709) and then click Save.
9. Tip To determine if there were errors during the backup process, you can check the .log file. The .log file is stored in the Temp folder for your user account. If a log file already exists from a previous backup or restore, a new log file is created with a different file name — for example, smigrate_1.log, smigrate_2.log, and so on. Search the log entries for the following error messages: cannot, could not, failure, server error, timed out, unable to, and the server sent a response.

Restore a Web site

Step 1: Create a new empty Web site as a destination

Note: Ensure that the Software versions are exact, same version of Service Pack and Hotfix. Also ensure that the OS is the same between the two destinations (IE 64 bit vs 32 bit)
1. Within SharePoint Designer, on the File menu, click New.
2. In the New dialog box, click the Web Site tab, click General, and then click Empty Web Site.
3. In the Specify the location of the new Web site box, enter the location where you want to restore the backup site. (TBD ex- http://NewSharePointsite.net)
You can restore the site to a different server, and you can restore it as either a new top-level site or a subsite under an existing top-level site.
4. Click OK.
5. Tip You can also create an empty Web site through the browser by using the Site Settings or Create pages. For example, when viewing the site in the browser, click Site Actions, and then click Create. On the Create page, under Web Pages, click Sites and Workspaces. Complete the first four sections, but when you get to the Template Selection section, close the browser without making a selection. Do not apply any template — including the Blank Site template — or the restore operation will fail.

Step 2: Restore the backup file to the destination
1. With the destination site open, on the Site menu, point to Administration, and then click Restore Web Site.
2. In the File Open dialog box, browse to and click the .cmp file that you want to restore, and then click Open.
3. If the current Web site is low on available storage space, click Advanced, and then do any of the following:
o To store the archive files in another temporary location, enter a new location in the Temporary location for archive files box.
Backing up a Web site requires a location to store temporary backup files. By default, Office SharePoint Designer 2007 uses the current Web site. You can use another site on the same server or a location on another server on the same network — for example, \\Server name\Share name.
o To store the .log file in another location, enter a new location in the Location for import log file box.
You might need to choose another location for the .log file if the server cannot write to the default location. By default, Office SharePoint Designer 2007 creates an import .log file in the current Web site. You can check this file to determine if there were errors during the restore process.
4. In the Restore Web Site dialog box, click OK to confirm that you want to restore the .cmp file to the current empty Web site.

Gotcha: Data View Web Part does not work.
The problem is that while restoring the site, SharePoint designer doesn't correct the GUIDs of lists being used. For example: You have a XSLT data view of a list called Contacts. When restoring SharePoint designer creates the list with a new GUID, but it uses the old GUID (from where the backup was made) of the list. The solution is simple: Fix the GUIDs of lists used in dataviews:
1. Open the Manage Content Administration page of your site (http://server/site/_layouts/mcontent.aspx)
2. Copy the shortcut of the list being used in XSLT to clipboard
3. In the URL you'll find the new GUID of a list between brackets ( in http://server/site/_layouts/ListEdit.aspx?List={89D731E5-0538-4999-B4AF-D7A5D9EA781F} the GUID is 89D731E5-0538-4999-B4AF-D7A5D9EA781F
4. With SharePoint Designer open the page with XSLT data view and search for term ListID in the code.
5. Select the value of the ListID parameter. It should be the GUID of the list (either in ListID="....." or in the same tag, look for GUID-like numbers.
6. Prest CTRL+H for Search and Replace with the value still selected. It will automatically populate the "Find what" field with it. Now paste the copied URL with GUID in the "Replace with" field and remove all but the GUID. Make sure you have the "Find in Source Code" option checked.
7. Now just press the "Replace all" button and your XSLT data view will reappear.

Monday, March 16, 2009

SQL Maintenence Plan for SharePoint

In all my dealings with SharePoint and SQL, it continues to amaze me in regards to how little attention is paid to the SQL portion of the SharePoint farm. I came across a great Whitepaper by Bill Baer and Microsoft that goes over how to set up a maintenance plan and also provide some great SQL commands for the Admin to use.
The link to the Whitepaper is here.

This Whitepaper is from Feb of 2008, focusing on SQL2005, but it is a great read, and will ensure your environment has a solid SQL maintenance plan in place.