Development

Using .NET 4 with SharePoint 2013

A while ago, I wrote an article about performing operations parallel with SharePoint 2010 (.NET 3.5). –> Execute code in multiple threads (even with SharePoint) Since I am not the only guy with this kind of “problems”, others are writing about SharePoint and .NET. Especially .NET 4.5 and SharePoint 2013. Stephane Eyskens hat posted a nice 6-post series about .NET within SharePoint 2013. Tuples Lazy Loading Sorted Sets Parallel.ForEach .

Caching objects with HttpRuntime

I won’t go into the arguments for using a caching mechanism or not. This post is simply an example for an easy way to cache data. So if you want to store some object in the cache, you can do so very easy. var localizedString = Caching.EnsureObject(resourceName, () => GetOperation(parameter)); As you can see, it really doesn’t matter what type of object the cache will store. class Caching { private static readonly TimeSpan Duration = new TimeSpan(1, , ); /// <summary> /// return cached value, or add and return from cache /// </summary> /// <typeparam name="

Execute code in multiple threads (even with SharePoint)

Since SharePoint 2010 uses .NET 3.5, you can not use the fancy new functions from .NET 4 🙂 So if we need e.g. multi-threaded execution of code, we’ll need to write the code ourselves. But, as you can see, this really isn’t so hard. The basic idea behind this solution of executing code parallel in threads, is that you have an IEnumerable of some kind. This can be a List, or any other IEnumerable.

Major Update to the Fileserveraccess Web Part

In 2008 I’ve released a Web Part, which enables your users to access files on your fileservers through SharePoint. Original post. This Web Part has been downloaded many times. With this new version, I’ve tried to deal with the most asked questions (like Kerberos), which will make the Web Part easier to use. Naturally new features have been implemented, to get you to upgrade to the new version. With this release, the Web Part requires SharePoint Foundation / Server 2010.

Update: WarmupScript

A long time ago, I posted a program which will hit all your sites. With parameters you can specify to hit all sites within a sitecollection. This program has been updated. You can not omit a start Url, and specify “Farm” as parameter. This way, all sites in all sitecollections in all webapplications in all… 🙂 will be warmed up. The warmup will use a HttpRequest to query all homepages.

What to know about the feature folder

One of the first things I used to tell guys new to SharePoint development is: Never ever name the folder of your feature “Feature1”. If you create a solution with WSPBuilder, or did some time ago with VS 2008, you have to rename the folders immediately! This is how a typical SharePoint project looks like, if you create features. I guess most of us have used the mighty WSPBuilder ( http://wspbuilder.

SPUrlUtility.CombinePath

Here is another “watch out” for using the SharePoint object model. SPUrlUtility.CombineUrl(web.Url, string.Empty) The line above will throw an exception, as CombinUrl doesn’t like empty strings. 🙂

StaticName != InternalName

Recently I was trying to fetch a SPField from a SPWeb object. I had SharePoint 2010, so I decided to use the new SPFieldCollection.TryGetFieldByStaticName() Method. You can imagine how surprised I was, that I couldn’t get the field I was looking for. What do we learn? Well, the StaticName of an SPField is not necessarily the InternalName! Here is a link to the MSDN about SPField.StaticName: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfield.staticname.aspx

Watch out for ContentTypeBindings

If you don’t know ContentTypeBindings, take a short look at: http://msdn.microsoft.com/en-us/library/aa543598.aspx “Content type binding enables you to provision a content type on a list defined in the onet.xml schema.” So we can assign content types to newly created lists. That’s cool 🙂 The ContentTypeBinding feature can, of coarse, contain multiple content types which are bound to multiple lists. Like this: <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <ContentTypeBinding ContentTypeId="0x0100yourGuid" ListUrl="Pages" /> <ContentTypeBinding ContentTypeId="0x0100anotherGuid" ListUrl="Pages" /> <ContentTypeBinding ContentTypeId="