March 2008 Entries

I have recently been involved in upgrading an old SharePoint 2003 intranet, with minimum customization, to MOSS 2007. At first on reading the documentation this seemed like a relatively easy process. According to the documentation the basic steps are:

  1. Install MOSS on the new server.
  2. Create a new website in IIS on the new server.
  3. Copy over all customizations, in my case none.
  4. Configure the new farm i.e mail settings, services on the servers in the farm.
  5. Run prescan.exe on the SharePoint 2003 content database.
  6. Mark the existing content db as read only to prevent additional content being added.
  7. Backup the database and restore it onto the new database server.
  8. Create a new web application; pointing it to the new website created in step 1 and change the database name to the one you restored.
  9. Click OK.

According to the instructions it will now go away and upgrade the old content database to MOSS 2007. Unfortunately after following all the steps I encountered 88 errors during the upgrade process.  The error message I received was complaining about a webpart on peoples my sites but after much searching the internet I found only one article with the same problem, however they had not come up with a solution either. Thankfully my sites were not used very often and the content was often out dated. As a result I was able to get around this by deleting all my sites from the content database. Obviously this is not an idea solution as in most cases if you are performing an upgrade then people may want to take content across from their my site so if anyone has encountered this problem before and knows a better solution then please leave a comment.

To get the upgrade working I not only had to delete all my sites from the web table in the database but also remove all references from other tables as well. This was a bit tricky as the WebId is referenced in multiple tables so i checked each table and if there was a reference to WebId I ran an SQL script to delete all entries from that table which were in the web table and are a my site, see script below.

Delete
FROM         WebMembers
WHERE     (WebId IN
                          (SELECT     Id
                            FROM          Webs
                            WHERE      (FullUrl LIKE 'personal/%')))

After doing this I re-tried the upgrade and everything went ok. Again this could potentially be an issue if you want to keep the my sites from the SharePoint 2003 site. As mentioned earlier if you know another way around this then please let me know.

 

Some other site I found useful for upgrade were:

 

http://alancoulter.blogspot.com/2007/05/ms-advantages-sps-to-moss-2007-upgrade.html

http://joeloleson.spaces.live.com/Blog/cns!B05AD15E2DE730DD!364.entry

http://geekswithblogs.net/RogueCoder/archive/2007/05/08/112343.aspx

http://www.sharepointblogs.com/johnwpowell/archive/2007/07/12/migrating-sharepoint-portal-2003-database-to-sharepoint-2007-using-content-database-migration.aspx

http://technet.microsoft.com/en-us/library/cc263299.aspx





Bookmark with :
Digg It! DZone StumbleUpon Technorati Reddit Del.icio.us Newsvine Furl Blinklist

Following on from my previous article Create Custom Visual Studio 2005 Website Project Template we decided that in addition to creating a template for all future website projects it would be a good idea to have templates for aspx pages and user controls that could be used in our website projects. In this article i will document the steps required for create a custom aspx page template but the same princples can be used for creating vaious item templates.

  1. Create your aspx page as normal in Visual Studio 2005
  2. Create a folder and place the aspx, aspx.cs and an xml document call with the extention of .vstemplate
  3. In the .vstempalate file add the following

    <VSTemplate Type="Item" Version="2.0.0"
        xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
        <TemplateData>
            <Name>BasePage</Name>
            <Description>Base Page.</Description>
            <Icon>Icon.ico</Icon>
            <ProjectType>Web</ProjectType>
            <ProjectSubType>CSharp</ProjectSubType>
        </TemplateData>
        <TemplateContent>
            <ProjectItem ReplaceParameters="true" TargetFileName="$fileinputname$.aspx">BasePage.aspx</ProjectItem>
            <ProjectItem ReplaceParameters="true" TargetFileName="$fileinputname$.aspx.cs">BasePage.aspx.cs</ProjectItem>
            <CustomParameters>
                <CustomParameter Name="$classname$" Value="$fileinputname$"/>
            </CustomParameters>
        </TemplateContent>
    </VSTemplate>

    This is the basic information you must supply in order to get your item template up and running. The first section describes the name and type of the item template so in this example I’m creating a custom aspx page for use in website projects. The main area that caused me some issues was setting the ProjectType and ProjectSubType correctly. I couldn't find any documentation on the actual combination required to get the template to appear under the 'My Templates' but this combinations works, for item templates in website projects, so hopefully it will save you some time.

    The next section lists all the files needed as part of this item template, which in this case are the aspx page and the code behind file. The key points here are the ReplaceParameters and TargetFileName options. The TargetFileName creates the page based on the one you've supplied but changes the name to whatever is supplied by the user. The other attribute I’m setting is ReplaceParameters and this looks in the file specified, in this case BasePage.aspx for anything with the format $parameter$ and replaces it with the supplied value. In my example in the aspx page we are using this to set the codebehind file, see below.
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="$fileinputname$.aspx.cs" Inherits="$fileinputname$" %>
  4. The final step is to zip up the files in my case BasePage.aspx, BasePage.aspx.cs and BasePage.vstemplate and copy them to C:\Documents and Settings\YOURNAME\My Documents\Visual Studio 2005\Templates\ItemTemplates\Visual Web Developer.


    You should now be able to create items that are based on your item template. One thing to remember is because I’ve set my ProjectType to be web I can only create templates in a website.

Bookmark with :
Digg It! DZone StumbleUpon Technorati Reddit Del.icio.us Newsvine Furl Blinklist

During one of my recent projects while talking with a colleague we were discussing the fact that in each website we created we had to perform the same tasks over and over. We decided that it would be a good idea to create a template that could be used as a starting point for all future projects, including custom error pages, global.asax, app settings, connection strings, master pages, themes and user controls. After some research I found there are several useful examples on the Microsoft site on how to do this.

The basic steps for creating a c# website project template are:

  1. Set up a website as normal in visual studio with all the files you want to include.
  2. Navigate to C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\ProjectTemplates\Web\CSharp\1033 and copy one of the existing templates zip files.
  3. Extract the zip file and copy the .vstemplate and .webproj files to the location of your own website.
  4. The existing .vstemplate might contain a lot of extra information but all you need to get up and running for the template data section is the following basic information

    <TemplateData>
            <Name>Template Website</Name>
            <Description>A simple Website template</Description>
            <Icon>icon.ico</Icon>
            <ProjectType>Web</ProjectType>
            <ProjectSubType>CSharp</ProjectSubType>
            <DefaultName>Template Website</DefaultName>
        </TemplateData>

  5. In the next section you must list all the files in your template site. For example

    <ProjectItem>App_Themes/Default/SkinFile.skin</ProjectItem>
    <ProjectItem>App_Themes/Default/StyleSheet.css</ProjectItem>
    <ProjectItem>App_Themes/Default/images/arrow.jpeg</ProjectItem>           
    <ProjectItem>Controls/HeaderUserControl.ascx</ProjectItem>
    <ProjectItem>Controls/HeaderUserControl.ascx.cs</ProjectItem>
    <ProjectItem>MasterPage/Global.master</ProjectItem>
    <ProjectItem>MasterPage/Global.master.cs</ProjectItem>

  6. Next zip up the files that you want to be included in the template website, including the .vstemplate and .webproject and copy them into the following location C:\Documents and Settings\YOURNAME\My Documents\Visual Studio 2005\Templates\ProjectTemplates\Visual Web Developer
  7. Now when you open Visual Studio 2005 if you go to add a new website you'll see your new template under 'My Templates'

Bookmark with :
Digg It! DZone StumbleUpon Technorati Reddit Del.icio.us Newsvine Furl Blinklist