Hello World Web Part Class Example

using System;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Serialization;

using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;

namespace HelloWorldWebPart
public class WebPart1 : System.Web.UI.WebControls.WebParts.WebPart
private string displayText = “Hello World!”;
[WebBrowsable(true), Personalizable(true)]
public string DisplayText
get { return displayText; }
set { displayText = value; }
protected override void Render(System.Web.UI.HtmlTextWriter writer)



Unhiding the hidden Event content type from the OOTB SharePoint 2007 Calendar

Found these tips on a blogging site, but couldn’t find them again to give the original author the credit. But to unhide the event content type from the OOTB SharePoint 2007 Calendar, follow these steps:

1.Go into the ‘List settings’ for an existing calendar on your site
2.Click on ‘Advanced Settings’ and tick yes for “Allow Management of Content Types”
3.This then shows the ‘Event’ content type in that calendar’s List Settings.
4.Click on the word ‘Event’ in the list of content types.
5.At the top of the next page it tells you that the parent is also called ‘Event’ – click on its link.
6.The following page tells you that the parent content type is in Group “_Hidden”.
7.Click on the “Name, Description & Group” link and then it allows you to put the ‘Event’ content type into a new group.
I put it into “List Content Types”. If I then go to create a new content type, the Event content type is selectable (under the parent of List Content Types).

SharePoint 2007 assembly missing error message

A bit of a note to self this one. I kept getting an assembly error following a deployment with the following message…

“An error occurred during the processing of . Could not load file or assembly ‘XXXXXX, Version=, Culture=neutral, PublicKeyToken=XXXX’ or one of its dependencies. The system cannot find the file specified.”

The solution… check that all the dlls are in the bin directory on the server’s file system along with references in the web.config.

Analysis of SharePoint 2007 Usage Reporting Capabilities

An element of site usage reporting is included as part of the ‘out of the box’ capabilities of SharePoint 2007. After usage reporting is enabled by your site administrator, you can append ‘_layouts/usagedetails.aspx’ onto any SharePoint site to get access to site usage data, provided you have the appropriate level of permissions.
For example: http:///_layouts/usagedetails.aspx

According to Microsoft, Site administrators and site collection administrators can view site usage summary pages that have the following information for their sites and site collections:

• Requests and queries in the last day and the last 30 days.
• Average number of requests per day over the last 30 days.
• A chart of requests per day over the last 30 days.
• A list of the top page requests over the last 30 days.
• A list of top users over the last 30 days.
• A chart of top referring hosts over the last 30 days.
• A chart of top referring pages over the last 30 days.
• A list of top destination pages over the last 30 days.
• Top queries for the last 30 days (if search usage reporting is enabled).
• Search results top destination pages (if search usage reporting is enabled).

SSP administrators for the search service can view a search usage reports page that tracks the following information.

• Number of queries per day over the previous 30 days.
• Number of queries per month over the previous 12 months.
• Top queries over the previous 30 days.
• Top site collections originating queries over the previous 30 days.
• Queries per search scope over the previous 30 days.

Site collection administrators for the SSP site can view a usage summary page that tracks the following information:

• Total amount of storage used by the site collection.
• Percent of storage space used by Web Discussions.
• Maximum storage space allowed.
• Number of users for all sites in the hierarchy.
• Total hits and recent bandwidth usage across all sites.

Site collection administrators can also view a site usage report that includes monthly and daily page hit totals filtered by the following criteria:

• Page
• User
• Operating system
• Browser
• Referrer URL

Usage Reporting from SharePoint Designer 2007

SharePoint Designer 2007 extends the functionality available in SharePoint, enabling you to measure site performance and usage using the following OOTB reports:

• Site summary report
• Broken links reports
• Reports about files
• Reports about shared content
• Reports about problems
• View the Usage Summary report
• View details usage reports
• Chart your usage data results

Most reports can be customised with the addition of sorting and filtering, copied and saved as an external file, such as Microsoft Excel.

For further information read ‘Use reports to measure site performance and usage’:

Third Party alternatives to the SharePoint 2007 Usage Reporting Solutions

• MAPIlab provides a tool that delivers richer stats:

• Nintex Reporting provides richer reporting on usage:

• Quest Capacity Management reporting tool has some interesting reports, including growth and trending reports:

• CardioLog Usage Reports for SharePoint

• AvePoint DocAve for SharePoint 2007

• Google analytics can be used by SharePoint sites and it’s free. CWaC are trialling this:

Broken links Scan

Scan broken links functionality in MOSS 2007 can only scan the broken links for sites created under the site directory. SharePoint Designer has a Broken Links report, but it’s poor and includes an awful lot of system files that you probably don’t want to know about.

A good alternative is Xenu’s Link Slueth and it’s available for free download too, from: http://home.snafu.de/tilman/xenulink.html

SharePoint 2007 Site Directory Broken Links Scan

I can’t believe i’ve not spotted this sooner!

A Site Directory can easily contain broken links because users (and sometimes site administrators!) have deleted sites and failed to tidy up behind them. As a site administrator, you can easily identify these sites by running the Broken Link Checker, that’s right in front of your nose! I’ve missed it for a while now.

The Broken Link Checker looks at each site in the Site Directory and stores those that return a 404 or 403 error. (Only http and https links are checked, not file, ftp, or mailto links). Broken links are then listed in a Broken link column in the Site Directory. You can delete the broken links individually or as a group.

To run the Broken Links Scan, click Site Actions > Broken Links Scan or append your site directory portal URL with /_layouts/linkschecker.aspx

SharePoint 2007 – Code blocks are not allowed in this file

Code blocks are not allowed in this file

If you come accross this error, here is the information you need to solve it:

Cause: you are running code snippets inside a file that is not allowed to do so by default.

Afected files: i.e. Master pages and Page layouts

Solution: you have to add an explicit authorization for the file(s) where you want to do so. The question is: do you really want to do it? You should take the best approach which is to add a code behind file (you can find how to do it here: Adding Code-Behind Files to Master Pages and Page Layouts in SharePoint Server 2007). If you still want to do it, just add a tag like this to your :