Tuesday, 24 November 2009

Debugging SmartPart User Controls

Ok, so you are faced with this situation

1. You are using SmartPart because its easier for your .NET developers to write UserControls, rather than WebParts (thank god for SharePoint 2010 where developing webparts will be easier at last).

2. Using SharePoint functions such as using SPContext and local debugging (i.e. using a normal web application for testing rather than SharePoint) present a headache, since the context is not available when you are debugging locally.

3. You need the best of both worlds, i.e. easy and quick debugging, but using SmartPart and user controls.

Here's the way to do it:

1. Create post build events which copy your User Control dll to the SharePoint folder, and your user controls to the UserControls folder

e.g. copy c:\develpment\xxx.dll c:\inetpub\wwwroot\80\wss\...

2. On the Web Application project properties, rather than using the Visual Studio web server for debugging, use the IIS webserver and specify the web application where your user controls are getting deployed.

3. Press F5 and voila, your dlls, and User Controls files are copied to SharePoint, and SharePoint is loaded and attached to the debugger.

This will now allow you to step into your User Control's code whilst having all SharePoint functions still available! :)

Monday, 5 October 2009

Reading Settings from the Web.Config file from an Event Handler

The SharePoint web.config is in my opinion the best place to put in any configuration settings. To read the config settings from an Event Handler isn't so straight forward but the following code does it nicely:

The SPItemEventProperties comes from the EventHandler.

You need to put in an appSettings tag in your web.config file, and then as many key value pairs as you need:

<add key="Username" value="svc-sharepoint"/>

public static string ReadKeyValueSetting(SPItemEventProperties properties, string keyName)
EventLog evita = new EventLog();
evita.Source = ("ReadFromConfig");
string webApplicationName = "";
using (SPSite siteCollection = new SPSite(properties.SiteId))
if (string.IsNullOrEmpty(siteCollection.WebApplication.Name))
throw new ApplicationException("Web application name is empty!");
else webApplicationName = siteCollection.WebApplication.Name;
System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration("/", webApplicationName);
if (config == null)
throw new ApplicationException("Web Configuration is null");
AppSettingsSection appSettings = config.AppSettings;
if (appSettings == null)
throw new ApplicationException("Web.config appSettings section cannot be found!");
if (appSettings.Settings[keyName] == null string.IsNullOrEmpty(appSettings.Settings[keyName].Value))
evita.WriteEntry("KeyName doesn't exist!", EventLogEntryType.Warning);
throw new ApplicationException("Key value cannot be read from appSettings. Make sure this key and its value exist!");
return appSettings.Settings[keyName].Value;

Monday, 28 September 2009

Using HTML to create visual graphics in SharePoint

ok, so you want to create some basic KPIs without installing / buying any webparts. You can do that, using a combination of Calculcated Columns and the Custom Editor Web Part.

Good Stuff, see more details here: http://pathtosharepoint.wordpress.com/2008/09/01/using-calculated-columns-to-write-html/

Thursday, 28 May 2009

Programing Search Queries

A good article by a MOSS MVP on the programming MOSS Search

Tuesday, 12 May 2009

WSS 3 - No search results returned

Well I've been banging my head against this error for quite a while and finally managed to resolve it.

Everything was setup correctly, none of the usual problems ... however one thing was missing. Indexing service had NOT been installed. Once the service was installed, and server restarted, search results started working correctly.

Hopefully this will help somebody else out there.

Wednesday, 29 April 2009

Exporting / Importing Profile Properties from your Shared Services Provider

If you ever had to customise Profile Properties in the Shared Services Provider, you'll know what a royal PITA it is to migrate the properties from one SSP to another (especially in a Staging environment). Typically, you would either backup and restore the SSP, or recreate the Profile properties from scratch. With the latter you would have the problem of possibly not recreating the properties identically to the latest version.

Sahil Malik comes to the rescue with the following great utility to Export and Import Profile Properties

Hats off to Sahil!

Thursday, 23 April 2009

My Profile Search Link Setting

When user's click on My Profile, the details entered are displayed with a link to a Search Center whic refines that link.

E.g. if your country is France, you get a link to a People Search which searches for other People whose country is France


In case you wanted to change the Search Center to direct the search to (Preferred Search Center), you'll find this setting in the My Site settings in the Shared Services Provider.

Wednesday, 22 April 2009

Customising Refine Your Search

The Refine Your Search is quite a nice feature of the People Search, through as always we'd love to be able to control the properties to Refine by.

Here's how to do it:

Monday, 30 March 2009

People Search Interesting Customizing Information

The following blog lists some good information about SharePoint People Search, and some problems / limitations which you will probably encounter when extending the Out of the Box People Search functions:

Extending ... both programatically and not

Changing the stuff on the My Profile page:

Friday, 13 March 2009

Programatically customizing Site Navigation in SharePoint 2007


Nice detailed blog with lots of explanantion on how to customize programatically. Personally, we are looking at deleting all items in the Quick Launch, and possibly recreating them from scratch as necessary during the creation of a MySite as per Steve's blog here.

Thursday, 26 February 2009

Adding Search Options in MOSS 2007 People Search

Although the Out of the Box People Search is quite nice, most clients would want to extend the people search with their own custom search options.

Fortunately, as with the adding of properties to the Advanced Search Box, this is fairly straightforward to achieve. The following article http://www.sharepointblogs.com/aaronrh/archive/2007/05/21/adding-additional-properties-to-the-moss-people-search.aspx explains how to do this.

Essentially the most important step is adding the following to the properties in the People Search WebPart:

<property name="NewProp" managedname="NewProp" profileuri="urn:schemas-microsoft-com:sharepoint:portal:profile:NewProp">

Partial Name People Search in MOSS 2007

One of the missing links which I personally find in SharePoint is the lack of a "partial" search, i.e. if I search for Tim, I found all those whose names starts with Tim i.e. Timothy, Timmy, etc instead of just Tim. This makes a lot of sense when working with employees of different nationalities who might or might find each others names difficult to remember.

Ramon Scott has the following sweet solution for defining your own Partial Search webpart. Although this is very close to hitting the spot, I would rather be able to modify /extend the actual people search webpart rather than creating a "new" one. 

I'll be researching this and hopefully eventually posting a solution. 

Wednesday, 25 February 2009

MCTS - Configuring MOSS 2007

This morning I passed the MCTS - Configuring MOSS 70-630, and was mostly a walk in the park. In the meantime, while doing some ETLs I found the following article useful: SSIS: File System Task Move and rename files in one step

Monday, 16 February 2009

MCTS - Configuring WSS 3.0

I've just passed MS 70-631 (972/1000). If you have good experience (1year+) with WSS 3.0 you should pass with flying colours. One suggestion, know your Network Load Balancing, especially the different between Unicast and Multicast, and how and when they should be used. Otherwise, not too many problems. Otherwise most of the questions should be quite easy if you've been working with WSS / MOSS...

Will be taking Configuring MOSS MS 70-630 in a couple of weeks time. I suspect this should be plain sailing too...

Monday, 26 January 2009

SharePoint Certification Resources

Sample questions:

For exam 70-630 (Configuring MOSS 2007) - http://drop.io/70630Qs

For exam 70-631 (Configuring WSS v3) - http://drop.io/70631Qs

Monday, 19 January 2009

Debugging SQL Server Integration Services Scripts

Debugging SSIS scripts is not the easiest of all things. Below we propose a number of ways to debug which we've seen in a presentation by Alan Mitchell - SQL Server MVP.

1. MsgBox messages - good during development, but not any good for production environments since once the MsgBox pops up it WILL wait for user input before the task proceeds.
2. Fire Events - the Progress / Output windows can also be used to ouput your debugging information.

Imports Microsoft.SQLServer.DTS.RunTime




3. Using Windows tracing events - System.Diagnostics.Trace.WriteLine, and then use a program such as Sysinternals DebugView to watch for this information.

Wednesday, 14 January 2009

Some Quick AdHoc Reporting on SharePoint

The following site lists a number of queries for quick performance / growth / usage reports


Tuesday, 13 January 2009

Several Interesting articles on MSDN re SharePoint customizations

Hadn't come across them yet, however found this wealth of information when trying to enable audting on WSS.