Thursday, October 25, 2007

SharePoint vs Developer

Just another day trying to learn SharePoint... Developing in SharePoint is a battle! Some of those days the errors: slap you in the face, kick your ass and finally they knock you out! Look familiar? Remember those days? You are absolutely not alone... read this funny story about a frustrated man, called Sean.

A SharePoint song related to the story:

Tuesday, October 23, 2007

Style the AutoCompleteExtender

In my previous post I wrote about building a custom field type, who extends the AutoCompleteExtender. Now... It all looks pretty, but if you take a look at the size of the textbox and the font of the dropdownlistitems you can see that we need to pimp our AutoCompleteExtender.

Here's the trick:
  • Link the textbox with the 'ms-long' class. This CSS class provides the style for the list item metadata fields within SharePoint.
  • Make a Div element that refers to the 'ms-long' class.

First we need to style the textbox:

Then style the AutoCompleteExtender dropdownlist:

  • Make a Div element just above the AutoCompleteExtenderTag:

  • Set the AutoCompleteExtender property [CompletionListElementID]:


Monday, October 22, 2007

Use ASP.NET AJAX framework with WSS 3.0

I had to make a custom field type, which uses the AutoComplete from the Ajax Toolkit.

"AutoComplete is an ASP.NET AJAX extender that can be attached to any TextBox control, and will associate that control with a popup panel to display words that begin with the prefix typed into the textbox. "

First I was afraid to begin with this task because of the rumors about the ASP.NET AJAX integration with Office SharePoint Server 2007 and Windows SharePoint Services 3.0 . After all, it turned out better than I expected.

What do we want to achieve:

I think it's unnecessary to write down an how-to. I made use of the following URL's to accomplish it.

The code beneath shows how to define the ascx control [Defines a SharePoint:RenderingTemplate element whichs tells SharePoint how to render your control].

Missing attributes in the AutoCompleteExtender tag:
ServiceMethod="GetEmployees" MinimumPrefixLength="1"

Chinese? Watch this video: How do I use the ASP.NET AJAX AutoComplete control?

So that's it... Questions / Comments? Feel free!

Saturday, October 20, 2007

How to remove a bad webpart from a page?

Previously, I added a poorly written webpart to my default.aspx page. The consequence of this action is that you aren't able anymore to load the page. In this case, the only thing you have to do is to remove the webpart. Removing the webpart in the webpart gallery doesn't solve this.

Append ?Contents=1 to the webpart page's URL to display the Webpart Maintenance Page. On that page you can delete the malefactor.

Example: http://moss/default.aspx?contents=1

Wednesday, October 17, 2007

SharePoint 2007 Development: Interactive Training Course DVD

SharePoint 2007 Development interactive course on DVD-ROM is intended for Developers, Administrators, Designers, Planers, Web Masters, and Managers.The training DVD provides a unique method of learning that allows you to see the steps, hear the explanations, and perform the tasks. Instructor demonstrations and hands on labs ensure that you fully understand all subject matters.

This DVD looks great!...

How to make a basic workflow?

For those who have never build a basic workflow, take a look at the DiceGame. This simple workflow just edit the title of the item, on which the workflow has started. The new title contains a number from 1 to 6. In the more complex DiceGame you will learn how to create a task if the number of the title is higher than three.

ow... I almost forget to say that there's also a next tutorial (making an initiation form on the DiceGame)

Have fun!

Tuesday, October 16, 2007

Custom Timer Job

I have been working on a Custom Timer Job (CTJ) to fix a little bug within our brand new intern portal. I have several tips for those who are making or willing to make one:

If you don't know how to make a CTJ? Take a look at: Example of a Custom Timer Job

How to debug a Custom Timer Job?

After installing and activating the CTJ - Feature
(Make sure that the code in the execute() method runs every minute. It takes less time to debug)

- Set a breakpoint somewhere in your code.
- Click 'Debug' in the toolbar (Visual Studio 2005)
- Click 'Attach to process'
- Select 'OWSTimer.exe'
- Everytime the code is being executed, the debugger starts working.
- Now you can enjoy 'debugging'

How to access the web.config within a Custom Timer Job?

Configuration config =
WebConfigurationManager.OpenWebConfiguration("/", "Sharepoint - 80");
string value = config.AppSettings.Settings["keyName"].value;

Hope , these tips save some developer time :)

Monday, October 15, 2007

LDAP attributes

If you want to perform queries against the Active Directory with the DirectorySearcher class, it might be handy to take a look at the several LDAP Attributes . You can use these attributes to build the query.

Getting accountnames from UserProfile Database

It was hard to find a piece of code to retrieve the Accountnames from users who are placed in the userprofile database. I found an example in the MOSS SDK:

using (SPSite site = new SPSite(http://servername/))
ServerContext context = ServerContext.GetContext(site);
UserProfileManager profileManager = new UserProfileManager(context);
foreach (UserProfile profile in profileManager)