Just little about C#, .NET, SQL Server, SharePoint and SAP

Archive for January, 2011

Localize your SharePoint using SPLocalize

Posted by zieglers on January 25, 2011

UPDATE: This project is published on CodePlex. http://splocalize.codeplex.com/

Nowadays, I’m working on another CodePlex project called SPLocalize. Basically this solution will help any SharePoint site to be instantly translated to any language. It can be used as an alternative to SharePoint localization. Advantage of this solution is that it doesn’t require any language pack to be installed on your servers.

Here are some teaser screens.. I’ll publish it on CodePlex soon.

Ok.. That many screeens is way enough. I think you got the idea already. 🙂

Any suggestions are welcome..


Posted in IT Stuff, SharePoint | Tagged: , , , , , , , , | Leave a Comment »

Best way to check whether List exists

Posted by zieglers on January 17, 2011

I was trying to figure out the best way to get a list instance from SPWeb object and finally settled down to this one.

There are many different ways to get SPList in SharePoint Object Model, but guess what, there is no Exist() or ListExist() sort of method in object model. What a shame, eh? You can simply loop thru web.Lists collection but there is a price to pay of course..

Needless to say you can’t use it directly like this, web.Lists[“myListName”], since you can easily get an ArgumentException if list you are looking for doesn’t exist.

So, what to do.. Let LINQ handle it for you.. Here is my favourite so far..

web.Lists.Cast<SPList>().Any(mylist => mylist.Title == listName)


Have a static class in your Utility classes like this.

// Check if a list exists in a web
public static bool ListExists(SPWeb web, string listName){
   return web.Lists.Cast<SPList>().Any(list => string.Equals(list.Title, listName));

Note that you need .NET 3.5 to use this.


Posted in IT Stuff, SharePoint | Tagged: , , , , , | Leave a Comment »