Development

Using TLS with SmtpClient

A rather small change to your code can increase security by sending E-Mails via an encrypted connection. Recently I stumbled across code, that send E-Mails with the System.Net.Mail.SmtpClient class. That piece of code did not try to communicated encrypted with the receiving SMTP server. So I changed that, to enable a TLS connection. try { var message = new MailMessage(); _smtpClient.EnableSsl = true; _smtpClient.Send(message); } catch (SmtpException ex) { // if the recpient mailserver does not support SSL, send without encryption _smtpClient.

The solution for warming up SharePoint

Most SharePoint Farms will have a solution for the long loading time after an Application Pool recycle or iisreset running. There are many different ways to preload websites, so your users have faster load times. So why another solution? There are some questions, that I think have not been dealt with before: Most solutions require some sort of Timer to be started (e.g. a Scheduled Task) When should the warmup occur?

SharePoint 2013 SDK

How could I miss the release of the SharePoint 2013 SDK in November? http://www.microsoft.com/en-us/download/details.aspx?id=30722 Anyway. Finally the non-preview version has been released 🙂

Building a Visual Studio project for SP2010/SP2013 (.NET 3.5/4.0)

In this post I will show you how you can use MSBuild to target your project for .NET 3.5 or .NET 4.0 and use a separate app.config file for each. My Warmup Tool is supposed to work with SP2010 and SP2013. To achieve that compatibility, I have to change the TargetFramework of the project to be able to compile, as well as the app.config so the application uses the desired Framework.

SQL Access to Configuration DB required

In many cases you pass an URL string to connect to SharePoint. In my case I wanted to verify the URL by using this code: 1: Uri requestUri; 2: if (!Uri.TryCreate(absoluteUrl, UriKind.Absolute, out requestUri)) 3: throw new ArgumentException(absoluteUrl + "is no a valid URL."); 4: 5: SPWebApplication webApplication = SPWebApplication.Lookup(requestUri); And here comes the “but”. I did not know that the account, which is executing the code, needs permissions to the Configuration Database!

When a Feature gets installed

Have you ever thought about the Features folder and when a folder will be created for one of you features? Well, I did 🙂 Why is this relevant, anyway? To be able to activate a feature on a given scope, it has to be installed first. That’s why. Action <td valign="top"> <strong>Result</strong> </td> </tr> <tr> <td valign="top"> stsadm -o addsolution </td> <td valign="top"> The solution is added to the farm.

Activating Features after Solution Deployment via VS

Visual Studio allow a F5 Deployment. I guess you all know that. The part where you have to think carefully is, when you add Features to your project. Should you activate “Activate On Default”? Well, it depends (as always). Usually I don’t enable that setting, because features tend to be activated on scopes you won’t expect. The problem Take a WebApplication scoped feature for example. It might create SafeControl entries for your controls.

SPQuery for my tasks

Developing solution with multiple languages (or a language which is not English) sometimes can be a bit painful. To configure a Webpart to display only my tasks, I would filter for [Me] or [Ich]. To achieve the same via code / CAML, you can filter by UserID and not the string “Me”. 1: <Where> 2: <Eq> 3: <FieldRef Name="AssignedTo" /> 4: <Value Type="Integer"> 5: <UserID /> 6: </Value> 7: </Eq> 8: </Where> 9: <OrderBy> 10: <FieldRef Name="

Do long running operations on SPListItem creation

Events on SPListItems like ItemAdding or ItemAdded are nothing new. Many of you have already used them. Recently I had a requirement to create a new SPSite, when an item in a list has been created. So an ItemReceiver was my choice. But the customer wants something special 🙂 During the creation process, which takes some seconds, the user should see a loading animation. Here comes the problem.

Now Available: Office Developer Tools for Visual Studio 2012

Finally! Now Available: Office Developer Tools for Visual Studio 2012 There are some points to mention, where the final release of the tools differ from previous preview releases: validation experience that helps you to find and fix common errors prior to submitting your apps to the Office Store A continuous integration workflow Windows Azure cloud service projects for creating provider-hosted Apps A dramatically improved Workflow designer The download link: http://aka.

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. classCaching { privatestaticreadonlyTimeSpan Duration =newTimeSpan(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.