Richard Davies wrote: The UK has a good crop of technology pioneers in cloud computing - for example ElasticHosts, FlexiScale, Flexiant, OnApp - and also some strong government initiatives such as G-Cloud.
We will have to see whether this kind of technical leadership converts into swift mass-market adoption or not.
This is another topic that is quite dear to most SharePoint developers. We’ve all been there. We want to know if a list item exists and the indexer is useless. It throws an exception should we attempt to access an item that does not exist. Well as we discovered this week there is a new TryGetList method that works great to determine if a list exists but there really isn’t anything new with a SPBaseCollection. We can do this a number of ways include spmetal.exe to generate strongly typed classes, but I was looking for a solution that didn’t require me to generate any classes. However, we can now use .OfType<T> to get an IEnumerable<T> that we can use. Once we have IEnumerable<T> it is quite easy to determine if a list item exists using the .Any() method. Look at the example below.
using (SPSite siteCollection = newSPSite("http://moss-server"))
As you can see using the lambda express p => p.Name we can do a comparison to see if a list item with that name exists. This will return us a boolean if the item does in fact exist. As you can see this isn't quite as good as a native method that checks for an item that exists, but it does work. If you want to get creative you can also check on other fields such as Title, Id, or whatever. Take a look at this sample.
As you can see, LINQ makes it quite easy to determine if an item exists. This may not be the most efficient way to do it as it is rather brute force. It may only be arguably better than using a try / catch block, but it certainly looks cleaner.
About Corey Roth Corey Roth, a SharePoint Server MVP, is a consultant at Infusion specializing in SharePoint for clients in the energy sector. He has more than ten years of experience delivering solutions in the energy, travel, advertising and consumer electronics verticals.
Corey specializes in delivering ECM and search solutions to clients using SharePoint. Corey has always focused on rapid adoption of new Microsoft technologies including Visual Studio 2010, .NET Framework 4.0, and Silverlight.
He is a member of the .NET Mafia (www.dotnetmafia.com) where he blogs about the latest technology and SharePoint. He is dedicated to the community and speaks regularly at user groups and SharePoint Saturdays.
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice: