Just noticed an amazing change in SharePoint 2010

No doubt there is many great changes in SharePoint 2010 over earlier versions, but some of them just come in very handy. The solutions I’m involved in at work often aggregate different information from several other SharePoint lists on the site, be it documents, contacts etc.

Lets say you have a customer list and want a customer page that shows saved documents, tasks and contacts for the selected customer. You would probably create a webpart page and add several listview webparts to that page. These list views need to be filtered so you either use one of the build in filter webparts in the Enterprise feature or you create your own. Lets say you have a querystring property called “customer” holding the name of the customer, and on the documents, tasks lists etc. have a lookup field holding the customer associated. You want a filter that makes sure only the documents for that customer is shown on you page.

This was certainly possible in SharePoint 2007, but the field you wanted to filter on had to be visible for you to be able to select it. This was a major obstacle as that information is just redundant, you have already chosen “Customer A”, why does it have to be visible for every document, task and contact on the page. It’s just stupid, and also takes up a lot of valuable page real estate.

Not to worry, enter SharePoint 2010, it now lets you select from all the fields in the list, including fields not visible in the view you have selected for your listview webpart. Thank you SharePoint 2010, you just made my job a lot easier :)

Posted in Uncategorized | Tagged | Leave a comment

My newfound hobby and the obstacles…

When working a deskjob you might from time to time need some exercise. I have been running a bit now and then, but I have never really found it to be the best workout for me, as my legs can’t handle more than 15-20 min of running. So it has never really catched on with me, and I get bored with it quite fast.

So I needed something else that wasn’t as hard on my legs. Enter the Mountain bike.  About 2 months ago I decided that something had to be done, so I went out looking and bought a decently priced mountain bike about 2 weeks later. And I’m hooked. Up until this week I mostly kept to large forest roads and paths. This has been just fine and I have been taking trips between 20 and 30 kilometers. But this Thursday I hooked up with a group from a local cycling club to take a ride on a new single track course they are building. That was the hardest thing I have done in a long while. The track, when finished, will be about 15 km I’m told, but my legs lasted about 2 km. Of course my overall shape is still terrible, but also the tires on my bike does not seem to like mud very much. Also the track is very new and not many people have been riding on it yet, so there is a huge layer of loose pine needles that makes your bike come to an absolute halt. So now I need to buy new tires so my back wheel wont just spin around when it gets wet, oh did I mention it rained like crazy :)

In time I would like to take my bike further away than can be ridden on bike, like compete in some races etc. I have a Toyota Aygo, a very small car without a tow bar and bike carrier. What to do? Well I found that if I take the front and back wheels off the bike and lay down the rear seats in the car it actually fits quite easily in the back. Look at this photo :)

Also today I went to watch a 12 hour MTB race, yes 12 hours! I have no idea how it must be to ride a MTB for 12 hours, if I ever participate it must be on one of the 4-member teams :)

I took a few photos, you can find them here.

PS, did I mention I’m hooked, this sport is just so much fun.

Posted in MTB, Sports | Leave a comment

A little Picasa Web Albums API friday tip

As promised yesterday here is a little bit of code I use to display photos from Picasa Web Albums. I use the Google Data API and their .NET client library. You can find it here, get the file named “Google Data API Setup (1.6.0.0).msi“. You might also want to check out the Developers Guide.

Anyway this will be a very brief and very focused little guide. The purpose? to display semi-random photos from a public Picasa Web album. First we need some references, and for this guide we will need the following.

  • Google.GData.Client.dll
  • Google.GData.Extensions.dll
  • Google.GData.Photos.dll

The files are probably located in: c:\Program Files (x86)\Google\Google Data API SDK\Redist\

We will be using four classes from the API, these are; PicasaService, PhotoQuery, PicasaFeed and PicasaEntry. They all inherit from some base Google Data API classes, but no need to worry about that now :)

Now for some code, we need to use the PicasaService class to query for photos, for this we need a PhotoQuery object to pass to the PicasaService‘s Query method. This results in a PicasaFeed object containing entries that represent the photos that we queried for, these are PicasaEntry objects that we can work with. We can get thumbnail- and photo URL’s among other things.

   1: PicasaService service = new PicasaService("slyngelstat.dk");

   2: PhotoQuery pq = new PhotoQuery(PicasaQuery.CreatePicasaUri("username", "5496727133364271337"));

   3: PicasaFeed feed = (PicasaFeed)service.Query(pq);

Now we can start using our feed. I created a small wrapper class, Photo, to make it easier to use in a small User Control.

   1: public class Photo

   2: {

   3:     public string Url { get; set; }

   4:     public string ThumbnailUrl { get; set; }

   5: }

The PicasaEntry object contains a large hieracy of data, the best way to learn what you need and not, is just to navigate through it using the Visual Studio debugger. But anyway we need to create this very advanced Photo object :) , and fill it with a random photo from the resulting Picasa feed.

   1: Random random = new Random();

   2: PicasaEntry entry = (PicasaEntry)feed.Entries[random.Next(0, feed.Entries.Count())];

   3:  

   4: Photo photo = new Photo

   5: {

   6:     Url = entry.Links[1].AbsoluteUri,

   7:     ThumbnailUrl = entry.Media.Thumbnails[2].Url

   8: };

That was easy enough. Now to display it in a UserControl you could wrap the above code in a simple method and use it in a simple get-property. Lets do that.

   1: public Photo GetRandomPhoto()

   2: {

   3:     // The code from above

   4:     return photo;

   5: }

And the get-property.

   1: private Photo randomPhoto;

   2: public Photo RandomPhoto

   3: {

   4:     get

   5:     {

   6:         if (randomPhoto == null)

   7:         {

   8:             randomPhoto = GetRandomPhoto();

   9:         }

  10:         return randomPhoto;

  11:     }

  12: }

When this is placed in the code of a User Control the following can be used easily from the markup and the photo will change when ever you load the page.

   1: <a href='<%=RandomPhoto.Url %>'>

   2:     <img src='<%=RandomPhoto.ThumbnailUrl %>' alt="photo" />

   3: </a>

And there you have it. This could be extended to a slideshow changing the photos every few seconds, kind of like I have on the front page at the moment.

The Google Data API is very usefull, this guide showed how to display photos from a public album, but you can also authenticate using your Picasa account, then you can upload new photos, create albums etc.

Everyone have a nice weekend, and by the way, guess who just started a two week vacation…AWESOME!!

Posted in .NET | Leave a comment

Welcome to slyngelstat

Hi, lets try this one again. It’s been a while since there was any activity on slyngelstat.dk. I’ll try a slightly different format this time, where the main site, slyngelstat.dk, will be more static and the blog will be hosted at wordpress.com.

The content on this site and the blog will be centered about software development, mainly the .NET platform and SharePoint. Although I might throw myself at some Android development in the near future. My new HTC Desire has been with me for about a month now and it is by far the greatest phone I have ever had.

Anyway, my name is Christian and I work at a small IT company that does small business solutions among other things. Most of my time is spend doing SharePoint development and consulting.

You might wonder what “slyngelstat” means. Well it is kind of a danish word, but I would translate it to something like “rouge state”, a word/phrase that has been used to describe countries like Iran and North Korea. Not that you should think of this site as a rouge state, I’m quite friendly.

Anyway enjoy, I’ll try to get some content ready as soon as possible. Maybe a few lines about Windows Azure or maybe a little post on how to use the Google Web Albums Data API with .NET.

Posted in .NET, Uncategorized | Leave a comment