.comment-link {margin-left:.6em;}

kHSw

Wednesday, October 11, 2006

MOSS 2007: Creating readonly colums in a list

I wanted to add a column to a list to store a date based on some heavy business-logic (the calculated column could not be used for this). The end user needs to be able to see the contents of this column, but should not be able to modify it.

Walking through the Sharepoint object model I discovered the CreateNewField Function on the SPFieldCollection in the desired list.
This (at the moment almost undocumented) function needs two parameters:
- typeName As String
- displayName As String
and is returning a SPField.

I had some trouble with the first parameter as it was not clear what exact it was expecting, most of the time the function just throwed a null reference exception (guessing because the errormessage still doesn't exist in the resource file). So I did some investigation with Reflector.
The typeName is expected to be one of the members of
Microsoft.SharePoint.SPFieldType enumeration ("DateTime" in my case).


Dim sps As New Microsoft.SharePoint.SPSite("http://www.vds-computing.com")
Dim spw As Microsoft.SharePoint.SPWeb = sps.OpenWeb("/kHSw")
Dim spl As Microsoft.SharePoint.SPList = spw.Lists("MyList")

Now I was able to create a new field for this list:

Dim spf As Microsoft.SharePoint.SPField = spl.Fields.CreateNewField("DateTime", "Test")

The only thing left is setting some parameters...

spf.ShowInDisplayForm = True
spf.ShowInEditForm = False
spf.ShowInNewForm = False
spf.ShowInVersionHistory = True
spf.ShowInViewForms = True
spf.AllowDeletion = False


(I just discovered that setting a column hidden will remove the ability to delete it via code)

...and to add the new column to the list

spl.Fields.Add(spf)


I created a Windows Service that calculates the date for new listitems, and a simple workflow is taking care of the rest...

Tuesday, October 10, 2006

Giganews Binary Newsreader Label Editor

Giganews Binary Newsreader is a cool newsreader with very nice looks. Try it, you'll love it...
The author, Uwe Keller, is looking for people that can help him to translate his software into their language.
I just finished the Dutch translation and I've written a small editor to simplify the translation process. You can download this editor for free from
http://blog.khsw-be.net/Download.asp?f=5

You'll be rewarded with a free license for translating! So give it a go...


Windows Vista RC2 install.wim

This weekend I downloaded Windows Vista RC2. I created a DVD out of the image and tried to install it in a virtual machine. After a few minutes, I got an error message ''Windows cannot open the required file E:\Sources\install.wim. The file may be corrupt or missing. Make sure all files required for installation are available and restart the installation.".

The file was available on the DVD and could be read. I visited a forum where someone suggested to write the DVD at the lowest speed possible. I gave it a try, but still the same error.


Since DVD's are too expensive in Belgium due to the unfair Auvibel-tax (*1), I tried mounting the image use Alcohol 120%. The install continued without any hickups...

If you're also having this error during installation, I would strongly advise to mount the image instead of downloading the image over and over again and toasting a whole spindle of DVD's.


*1 : Due to this Auvibel tax, I (and everyone else buying DVD's in Belgium) have to pay the music industry 0,714 euro (about 0,895 dollar) for every DVD I use. Why do I have to pay them for burning beta-software???

Design a MOSS 2007 workflow locally

After installing Microsoft Office Sharepoint Designer (MOSD) 2007 on my client I tried to create a workflow on a remote Microsoft Office Sharepoint Server (MOSS) 2007 server. I connected to the Sharepoint server using MOSD but when I tried to create a workflow I got the error message 'The list of workflow actions on the server references an assembly that does not exist. Some actions will not be available. The assembley strong name is Microsoft.SharePoint.WorkflowActions, Version=12.0.0.0, Culture=neutral, PublickeyToken=71e9bce111e9429c. Please contact your server administrator.' .

Using the
Sysinternals Filemon tool, I discovered MOSD was looking for that assembly on the local machine (and not on the server as stated in the error message). I copied the assembly from the GAC of the server to my local GAC, and that error was gone.
However, I could not create a new workflow:
'Failed to load the workflow'.

I did install some other Office 2007 products so installed the
Technical Refresh for beta 2. Big mistake! The menu-items of MOSD were completely screwed up...
File > New > Page
was now looking like
0,0 > elete MailerExpand MailerSend MailReplyReply
AllForwardGrammar...Not ApplicableCloseText to/from TableInsert T > Refresh


I tried removing, reinstalling, cleaning the registry, cleaning the filesystem, reinstalling, ... no luck however. So I decided to restore my system to the restoration point I created before installing MOSD.

In the meantime I had stumbled upon a page starring a
technical refresh for MOSD only. I reinstalled MOSD (I did not reinstall any other Office component) and ran the technical refresh on this product. And now I'm about to create my first workflow using MOSD ;-)

VDS Computing

It's a long time since I've updated my blog... At the end of this month they should start building our house. The last weeks I've been quite busy doing some thinking, arguing, preparing, discussing, ...

I also quit my job at Dolmen after 7 years because I was tired of the daily traffic jams. Dolmen is a great company to work for, but with many customers in Brussels. I spend about 12 hours in my car every week... Since my wife is pregnant (14 weeks for now), it's nice to have a job close to home. And I did find a job close to home, very close, about 2 kilometers (1,25 miles). As from 2 october, I'm working for VDS Computing in Lokeren.

Currently I'm preparing a demo for the 'Ready for a new event' next month using Microsoft Office Sharepoint Server 2007...


 
Stefanie Worm is het liefste vrouwtje van de wereld.
Melina is de liefste schatsie van de wereld (Erik De Maeyer).