Monthly Archives: January 2009

SharePoint Dispose Check

SPDisposeCheck is a tool to help you to check your assemblies that use the SharePoint API so that you can build better code. It provides assistance in correctly disposing of certain SharePoint objects to help you follow published best practice. This tool may not show all memory leaks in your code. Further investigation is advised if you continue to experience issues. It’s a must for every SharePoint developer!

Read more about it here:

http://code.msdn.microsoft.com/SPDisposeCheck

SharePoint Analyzer

Some days ago i was browsing the internet for sharepoint analyze tools. On tool has been developed by the well known “Bamboo Solutions”, it’s called “Bamboo SharePoint Analyzer”. It helps discovering the SharePoint administration:

  • The information for the entire farm topology, from Web Applications down to individual lists.
  • Server information, including patches and updates.
  • Information on databases that are being used as part of your SharePoint deployment.
  • Solutions and Features that have been deployed, displayed per Web App, Site Collection or Site scope.
  • Services and their status.
  • Content of the log files in your SharePoint farm (v1.1)
  • Integrate and display reports from MS Best Practice Analyzer (v1.1)
  • Display farm access accounts information (v1.1)
  • Information about Bamboo products that are used in your farm, and compare with latest version available on the Bamboo web site (v1.1).

For a download and more information, go here:http://community.bamboosolutions.com/blogs/bambooteamblog/archive/2008/11/07/introducing-bamboo-sharepoint-analyzer.aspx

More about SharePoint eventhandling

 

As I had problems with the way events worked, I wanted to know more about the way they worked. below is bit of information about events that is good to know:
There are two different kinds of events: Synchronous and Asynchronous events.

  • Synchronous events
    • End with -ing (ItemAdding, ItemUpdating)
    • Block the code as long the events arent finished
    • Can (thus) make use of Session vars (HttpContext.Current is available), because they run in the same session
    • Can be used to prevent the event being finished. For example, with the ItemUpdating event you can verify the content being updated. Is the update not valid, the SPItemEventProperties.Cancel can be set to true and the SPItemEventProperties.ErrorMessage can be filled with an error message. This error message will not be displayed, but is written to the logfile. An error page will appear.
    • dont contain the SPListItem in it’s SPItemEventProperties so when you want to make changes to any of it’s field you need to make use of the SPItemEventProperties.AfterProperties (see message below). In the case of itemUpdating, the “old” SPListItem will be used
  • Asynchronous events
    • End with -ed (ItemAdded, ItemUpdated)
    • Dont block the code.
    • Can’t (thus) make use of the Session (HttpContext.Current is null, because code is run in another context)
    • Can’t be reverted; When these events are fired, the item is already added, updated or deleted.
    • contains the SPListItem. Changes can be made if you want to. This fires the (for example) ItemUpdating and ItemUpdated event. This can be turned off by using this.DisableEventFiring();
    • When creating a new list, events like FieldAdded and FieldAdding are not fired!