Wednesday, April 08, 2009

Microsoft SharePoint 2007 - Fixing a failed WSS v3 and/or MOSS 2007 SP1/Infrastructure Patch Upgrade

The Upgrade Process
I was upgrading an environment (MOSS version 12.0.0.4815) in the following manner:
  1. Check all Timer jobs have run to completion in the existing environment
  2. Check no errors with WSP
  3. Install WSS v3 SP1 Patch (Skip Configuration wizard)
  4. Install MOSS 2007 SP1 Patch (Skip Configuration wizard)
  5. Install WSS v3 infrastructure Patch (Skip Configuration wizard)
  6. Install MOSS 2007 infrastructure Patch
  7. Following the prompts for the Configuration Wizard (PSconfigUI).

Okay, so far so good.

The Problems
In the middle of the configuration wizard, it seemed to have stayed on Step 5 for hours. Looking at the Event Viewer, errors with messages:

Content index on Search could not be initialized. Error The content index is corrupt. 0xc0041800.Component: bd72df39-396a-472f-8a1a-db6c3241e922



Checking Upgrade.log (in 12\Logs\), unveiled some Exception errors.

The Solution
So then I cancelled out of the setup (which took a while to cancel – actually it didn’t cancel until I ran the following command), and ran the following command to force the upgrade of the SharePoint environment:

psconfig -cmd upgrade -force



Checked the version numbers and the existing sites I had - That seemed to have fixed my issues


Alternative
Alternatively, the stsadm utility can be used (though I didn't have to use it):

stsadm -o upgrade -forceupgrade

For more details on this command:
Upgrade: Stsadm operation (Windows SharePoint Services)
http://technet.microsoft.com/en-us/library/cc288073.aspx

Upgrade: Stsadm operation (Office SharePoint Server)
http://technet.microsoft.com/en-us/library/cc263413.aspx



References
Command-line reference for the SharePoint Products and Technologies Configuration Wizard (Office SharePoint Server)
http://technet.microsoft.com/en-us/library/cc263093.aspx

Install Windows SharePoint Services 3.0 by using the command line
http://technet.microsoft.com/en-us/library/cc752946.aspx

Thursday, April 02, 2009

Microsoft SharePoint - Version numbers

It's been the Nth time I've had to checkup the version of SharePoint that is installed on a Farm - and I am now finally keeping this here for my own notes.

All these times I've been hitting back on a very nice post by Penny Coventry that contains a list of SharePoint Patches and respective version numbers:
http://www.mindsharpblogs.com/penny/articles/481.aspx

The easiest ways I use to check version numbers are:
1. In Central Admin, Site Actions > Site settings:



OR

2. In IIS, right click on the web application and select properties > 'HTTP Headers' tab, under Custom HTTP Headers section:

Monday, March 09, 2009

Microsoft SharePoint 2007 - Understanding performance considerations in SharePoint OM

A colleague, Fernando Felman has highlighted a very useful and interesting blog spot by Andreas Grabner that walks-thru scenarios and looks into the performance of SharePoint when under various SharePoint object model calls.

Though quite a few points in the post are obvious to the developer, I still think it is worth a good read :)

The article:
SharePoint Object Model Performance Considerations
http://www.infoq.com/articles/SharePoint-Andreas-Grabner

Sunday, February 22, 2009

Saturday, February 21, 2009

Microsoft SharePoint 2007 - SharePoint Lookup Field Relinker Utility

I've had a dig into my code stash, and found that I actually have a tool to help reassociate SharePoint lookup fields to lists. You'd only every really need to reassociate if the list referenced by the lookup field has an altered GUID. The GUID of a list would change if it has been deleted, or if you migrate a list from one environment to another.

I'm quiet flat out atm, so I'll post some more information in the next week or so with instructions on how to use this tool.

Background
This tool was used as part of a migration plan across servers using site backup and restore. The restored site ended up with lists that had lookups that did not associate with the appropriate columns. This is because the ID of the list in the new environment is different after a restore. Therefore the stored lookup field definition will no long be validly pointing to the correct ID of the list column that it was associated with - hence the need for this tool to reassociate such lookup fields with the relevant list columns that it references from.

Hopefully this little tool could help save alot of pain in migrating lookup fields in lists.


Some notes on the utility:
--------------------------------------------------------------------------------------
This tool was developed to reassociate or fix SharePoint lookup fields to lists in a site.

This tool is able to:
1. Relink lookup fields
2. Relink multiple lookup fields from an XML definition (Bulk tasks)
3. View Field Schema

This tool is useful in the following scenarios:
1. A list a lookup field is pointing to has been deleted and needs to be linked to a different field in a different list
2. A site backup is made and is restored in a different environment - The lookup fields will no longer link to
the field even thought the appropriate lists may be created. This tool will help relink the fields

Requirements for this tool to run:
1. Must login as Site Administrator - as the code will delete the lookup field and recreate it (Did not use RunWithElevatedPrivileges() for security purposes.)
2. Tool must be run on a WSS v3.0 or MOSS 2007 Server directly
3. Sorry, this tool has only been tested on an English environment - but theoretically should still work
with other localisations of SharePoint instances.

Where to download:
http://www.codeplex.com/SPLookupLinker

Tuesday, January 20, 2009

Microsoft SharePoint 2007 - Calculated fields VS Computed fields

Audience
This article is intended for SharePoint Developers. Non-Developers, can understand what SharePoint can do thru this article. As I couldn't find much about this topic on the net, I thought I'd write about it :)

Introduction

SharePoint, being apart of Office, inherits a feature that is familiar amongst Microsoft Excel users - aka the "Calculated Field", which allows the user to specify a formula to determine the value of a field based on the value of other fields.

Recently I've had a go at trying to combine multiple reference fields into one field in SharePoint. Whilst there are many ways to do it (with an event handler, workflow, or calculated fields), I'd like to present to you a very clean solution based on a "Computed Field" type.

Computed fields are used by standard SharePoint components. For example, in a Blog Site there is a list named "Posts". This list contains a field called "PostedByWithDate" - which is a combination of a "Published" date-time field and a "Created By" person field. The output not only contains a combination of "Publised" and the "Created By" values but also includes custom text:



To show you what I mean, this is the "Posts" list, and their values:


Time to Play with Computed Fields
So what can we do with this? We can set the value of a computed field conditionally thru some field reference definitions!

Lets start by looking at the definition for the computed field (I'll assume you read the SDK to understand this):
<Field Name="OnBehalfOf" ID="{e9d780a5-ac18-4a04-ad63-39c6a7417212}" DisplayName="OnBehalfOf" Type="User" Required="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" List="UserInfo"
Description="Use this field when you are posting on behalf of the blog owner" ShowField="ImnName" UserSelectionMode="PeopleOnly" UserSelectionScope="0" StaticName="OnBehalfOf" ColName="int3" RowOrdinal="0" />


Original
The original field definition for the PostedByWithDate field (Which I extracted from the SharePoint Blog Site Definition contains):

<Field Name="PostedByWithDate" ID="{a1944d80-14e6-a71c-b235-3a28329f14b1}" Type="Computed" ReadOnly="TRUE" DisplayName="$Resources:posts_schema_blgfld_postedbywithdate;" Sortable="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3"
StaticName="PostedByWithDate">
<FieldRefs>
<FieldRef Name="Author" />
<FieldRef Name="PublishedDate" />
</FieldRefs>
<DisplayPattern>
<HTML><![CDATA[Posted at ]]></HTML>
<Column Name="PublishedDate" Format="TimeOnly" HTMLEncode="TRUE" />
<HTML><![CDATA[ by ]]></HTML>
<Field Name="Author" />
</DisplayPattern>
</Field>



SharePoint Magic
Now what I did was create a copy of this column (in a new Site Template - remember it is not supported only if you modify existing SharePoint Site Templates), and modified it like the following:

<Field Name="PostedByWithDate" ID="{a1944d80-14e6-a71c-b235-3a28329f14b1}" Type="Computed" ReadOnly="TRUE" DisplayName="$Resources:posts_schema_blgfld_postedbywithdate;" Sortable="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3"
StaticName="PostedByWithDate">
<FieldRefs>
<FieldRef Name="Author" />
<FieldRef Name="OnBehalfOf" />
<FieldRef Name="PublishedDate" />
</FieldRefs>
<DisplayPattern>
<HTML><![CDATA[Posted at ]]></HTML>
<Column Name="PublishedDate" Format="TimeOnly" HTMLEncode="TRUE" />
<HTML><![CDATA[ by ]]></HTML>
<IfEqual>
<Expr1>
<Column Name="OnBehalfOf" HTMLEncode="FALSE" />
</Expr1>
<Expr2></Expr2>
<Then><Field Name="Author" /></Then>
<Else><Field Name="OnBehalfOf" /></Else>
</IfEqual>
</DisplayPattern>
</Field>

The node is used for fields to allow for custom presentation of information. nodes can be added to introduce logical conditions for how data is presented. gives the field if-else logic; in this case, it checks if the value of the "OnBehalfOf" field is equal to nothing, and if it is, return the value from the "Author" field, else return the value from the "OnBehalfOf" field.

Very straight forward indeed :) The result can be seen in the screen shots above - when the OnBehalfOf field is blank, the value in the "Created by" field is shown with the date.


Some References:
Field Element: http://msdn.microsoft.com/en-us/library/ms437580.aspx
DisplayPattern Element: http://msdn.microsoft.com/en-us/library/ms977561.aspx
IfEqual Element: http://msdn.microsoft.com/en-us/library/ms948315.aspx



Tuesday, December 09, 2008

Microsoft SharePoint 2007 - SharePoint Designer Workflows does not automatically start

Today, I created a SharePoint Workflow with SharePoint Design 2007, selected the options for it to be started upon the creation of a new item and upon the modification of a new item. It didn't start!

However, if I enable the option to start the workflow manually, and do so, the workflow starts!

A google search lead me to an answer:


This behavior occurs because a security fix in Windows SharePoint Services 3.0 SP1 prevents declarative workflows from starting automatically under the system account. After you install Windows SharePoint Services 3.0 SP1, declarative workflows do not start automatically if the following conditions are true:

  • The Windows SharePoint Services Web application runs under a user's domain account.
  • The user logs in by using this domain account.
  • The site displays the user name as System Account.

Source: http://support.microsoft.com/kb/947284

Thursday, October 09, 2008

Microsoft Office SharePoint Server 2007 - My Sites and "Portal Site Connections" to change breadcrum behaviour

Summary
My Sites have proved to be a true value-add to any organisation as it does improve social personal information sharing (and alot more). It is easy to setup and logical to use.

There are however still several glitches when it is first setup in an environment. For instance, many users have found that once they navigate to their MySite, there is no link in the breadcrum back to the main Intranet Portal (as illustrated below):


Luckily, there's a setting called "Portal site connections", once this setting is set, you would have modified the behaviour of your My Site breadcrums (as illustrated below):


Making the configuration change
Assuming we want to make this change to all My Sites under the current "My Site Host", we will need to perform the following steps:

1. Login to My Sites as the My Site Host owner (in my case this user is administrator)
2. Browse to the "My Profile" tab
3. Click "Site Actions"
4. Select "Site Settings" from the Site Actions menu (or http://mysiteurl/_layouts/settings.aspx)



5. Click "Portal site connection" under Site Collection Administration


6. Select Connect to portal site and fill in a URL and link name (example illustrated below):
7. Click "OK"



Notes: When you now go back to the "My Profile" tab, you will see the change immediately. This change will only be valid for any new "My Sites" that are created (Not the MySite host or My Profile tab. Yes, personal sites aka the "My Home" tab) . For "My Home" tabs in existing "My Sites", you can either recreate the My Site, or make the same configuration via the following instructions:

1. Login to My Sites as the My Site Host owner (in my case this user is administrator)
2. Browse to the "My Home" tab
3. And follow from point 3 in the instructions above

Tuesday, September 09, 2008

Microsoft SharePoint 2007 - New SharePoint SDK

In the most recent MSDN flash are the following updates to take note of - some new SharePoint SDK releases:

Download the SharePoint Server 2007 SDK (Aug 08 1.4 Refresh)
The August 2008 update of the SharePoint Server 2007 SDK contains documentation for new and improved features in the Infrastructure Update for Microsoft Office Servers and new conceptual, procedural, and reference information. You can also
view the August update online.

Download the Windows SharePoint Services 3.0 SDK (Aug 08 1.4 Refresh)
See the latest additions to the Windows SharePoint Services SDK. Find conceptual overviews, programming tasks, and references for Windows SharePoint Services.
View the Windows SharePoint Services 3.0 SDK online.

Monday, September 08, 2008

Microsoft Office SharePoint Server 2007 - Best Practices Resource Center for SharePoint Server 2007

What is the best way to do something in SharePoint?

Recently, the SharePoint Team Blog announced the SharePoint Best Practices Series (http://blogs.msdn.com/sharepoint/archive/2008/08/29/announcing-the-sharepoint-best-practices-series.aspx).

The series includes a "Best Practices Resource Center for SharePoint Server 2007" site, which includes all guidelines about implementing Search, Publishing Portals, My Sites, Team Collaboration, SP Development, and more!
http://technet.microsoft.com/en-us/office/sharepointserver/bb736746.aspx