Adding a column to SharePoint news articles (design/edit view)

The ‘News site’ site template of MOSS 2007 is probably one of the most used templates for companies which use SharePoint for their internal intranet. It allows you to add news items to a specifically designed site in a user friendly way. Editing the news items is done on the page itself, with extra functions for checking in/out pages, publishing concept and final versions and much more.

One of the questions many people asked me is: “Is it possible to add extra columns to the default news site?”. Offcourse it is! Just go to the article pages document library and add a new column. Unfortunately there’s one little problem with that approach: your newly added column won’t show on the ‘edit  page’ but only on the document properties page. That’s not cool, since your users would have to switch back and forth between the ‘edit page’ layout and the document properties to fill in all columns. You would much rather add the column to the ‘edit page’ layout and perhaps show it on the article too, right?

Read More

Inter-application communication with WCF webservices

Unfortunately for me (but not unfortunately at all I guess), not all software developed right now is .NET based. That’s fine because there are a lot of other really good alternatives out there which do the trick and in some cases even do the same trick even better. And even when a .NET based application seems to be a better choice, there are a lot reasons why you’ll still want to develop a non-.NET app. For instance: let’s say we’ve got an big application developed in Java, Oracle or Progress. It makes sense that new requirements made by your customer will end up being developed in the same language/environment used for building the main app, right?

But how about giving the new part of your application a modern “Office style” look? Using .NET with some 3rd party components that’s a piece of cake, but not all development environments offer the possibility of developing nice looking applications. And I’m not even talking about all really nice framework parts which are available in .NET development.

A possibility would be to create the new ‘module’ of your application using .NET, but that would (in most cases) require some-kind of communication mechanism between the ‘main app’ and your module. Now with .NET 3.0 that’s possible and made easy for you using webservices!

Read More

VS Designer throwing ‘Operation could not be completed’ error.

Today, while working with the Linq designer, my Visual Studio installation started throwing errors at me. They stated ‘Operation could not be completed’ followed by some Dutch nonsence which didn’t help much.

At first, I thought this had to do with me altering the database structure and then opening the Linq designer again. I tried deleting some of the altered tables in the designer files, but that didn’t help. Then I (quite randomly) clicked the database connection in the Server Explorer. It threw another error stating the application event log was full. I checked and that message was correct. After clearing the log, the errors disappeared and everything worked well again. So when you encountred this error: clear your application event log!

LinqDataSource not deleting records

I ran into a small problem using the LinqDataSource as a datasource for a GridView or ListView (the new 3.5 ListView features quite nice functionality, with an insert-capable grid!).

I had set up a datasource with a ListView bound to it which had a button per row to call the ‘Delete’ command. The other commands seemed to work fine (insert, edit) but the delete command didn’t do anything. Just a postback; no exception, no deletion, nothing.

After a lot of debugging, I found out I had set the primary key of my Linq object to be ‘readonly’. I had done this to prevent users from altering the PK and thereby breaking the database. Since the primary key was a generated uniqueidentifier anyway, I didn’t want my users to mess with it.

Anyway; after removing this setting (thus setting it not to be read-only), it suddenly deleted records just as I wanted it to.

The designer’s description for the Read Only setting is: “Controls whether an a set accessor is generated.”. That’s because each column/members get’s its own property with a get/set accessor. I’m not quite sure why this disables the possibility of deleting an object. Perhaps because you can’t create the object without setting it’s primary key, which makes sence. But then again; how is the object populated from the database with the correct private key and why is that method not used to populate it again on postback? Better yet: I would suppose the entire object is stored somewhere in the viewstate between postbacks so the primary key should be in there somewhere, right?

I’m not quite sure about why, but I do know you’d better leave your primary key not be read-only, unless you never want to delete that object.

More Linq to SQL

If you’re into ASP.NET and you want to learn Linq to SQL to provide your user with data from your SQL database, you need Scott Guthrie. And if you don’t know that name yet, you should definitely check out his blog.

For his articles on Linq to SQL, please check out these links:

Free stuff from Microsoft

Surfing around the web I stumbled upon this blogpost from Mohamed Ahmed Meligy writing about free stuff from MS. I thought this would be somekind of action I missed out on and was already too late to sign up for. But no! I tried and this link still takes you to a Microsoft site which requires you to enter your live ID and enter all the profile stuff you’ve probably entered 1000 times already. But after you do that, there are three e-books, one of which is complete, downloadable for free. They’re:

– Introducing Linq
– Introducing ASP.NET AJAX
– Introducing Silverlight 1.0

The Linq one is free in it’s entirety, so no need to buy it anymore. Thanks Microsoft and thanks Mohamed for putting it out there!

My first Linq steps

First of all, I would like to wish you all a happy new year. I know it’s a bit late for that, but I didn’t get (or take…) a chance to post my first blogpost of 2008 earlier. I’m eager to find out what this next year is going to bring us, but I guess I’ll have to wait another 11 1/2 months to be sure 😉

Now, to start off the new year with some tech-talk, I wanted to write a little bit about Linq. Linq is the new way of talking to your database, as far as Microsoft is concerned. It’s kind-off a replacement of the DataSet with DataTables and TableAdapters used in .NET 2.0 projects. Replacement might not be the best way of putting it, because as far as I know, Linq doesn’t really store data the way a DataSet does (keeping DataSets still a very usefull way of storing relational data). Read More

Versioncontrol & Inconsistent filesizes

It’s been a while since my last blogpost. That’s primarily beacuse I’m doing a lot of non-web work at the moment so there’s not too much to blog about.

But now I received a question from a customer which I cannot answer. It seems SharePoint’s file saving functionality is a bit inconsistent when version control is turned on. This is quite easily reproducable in any document library. Take the following steps:

– Create a new document library which has version control turned on
– Upload an empty word document, I didn’t check but I think this will work on any type of document
– Now upload the word document again to overwrite version 1.0 with a new version. U can repeat this to upload some more versions if it doesn’t work the first time.
– Open the documents context menu to view the version history of the document.

If I take above steps, all uploaded versions seem to have a different filesize, even though there’s nothing changed in the file itself. This could be metadata changing, but you would say that information only grows in size, while the file size both grows and shrinks.

If someone knows why this happens, please leave a comment here, I’m eager to find out!