Step by Step: How to Add jQuery to a SharePoint 2010 Site Collection

Written by Denis Stadler on . Posted in jQuery

Both SharePoint 2010 editions (Server and Foundation) don’t provide a built-in feature that activates jQuery in a site collection.

Adding jQuery to SharePoint might not present a high interest for a traditional intranet portal solution, but if we use the Publishing feature, especially in web sites, jQuery could help us to improve our users’ experience.

The easiest way to add jQuery is, of course, to edit the master page and add the following lines of code, before the closing </head> tag:

<script type="text/javascript"
src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script type="text/javascript"
src="//ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js">
</script>

This code show his limitations if the computer of the user connecting to the SharePoint solution doesn’t have an active internet connection.

The Build of an Add-jQuery SharePoint Feature

A more elegant solution is to build a custom feature that injects the code in the “PlaceHolderAdditionalPageHead” content place holder, a content place holder that should exist on every SharePoint master page.

<asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead"
runat="server"/>

To achieve this, I had initially to create a new SharePoint empty project using Visual Studio 2010.

How to Save Configuration Data in SharePoint Development

Written by Denis Stadler on . Posted in Custom Development

When we develop custom application over the SharePoint platform, often we need to store different configuration parameters as: connection strings, e-mail addresses, URLs or different data parameters.

In SharePoint we have the following possibilities to store the configuration data (I will enumerate them based on my preference):

SharePoint Property Bag

This can be used for all the custom SharePoint solutions (Farm, Web Application, Site Collection, Web). The only disadvantage that I found is the fact that you have to build an application page or a web part to manage this items, because there is no interface provided by default.

What I wanted to share in this article were the get/set (load/save) methods that I use to access the Property Bag in my custom solutions. Usually I create a public static class called Helpers, where I store all the common methods needed in a solution. To load and save the Property Bag data I created a LoadProperty and a SaveProperty method with two overloads each.

In case we call this method from a FeatureActivated event, we need the second overload. In this case the object SPContext.Current.Web does not exist. Anyway you can find below the code that I used:

#region Load Configuration Property
public static string LoadProperty(string strKeyName)
{
string strResult = string.Empty;

SPWeb webCurrent = SPContext.Current.Web;

if (webCurrent.Properties.ContainsKey(strKeyName))
{
strResult = webCurrent.Properties[strKeyName].ToString();
}
return strResult;
}

public static string LoadProperty(SPWeb webCurrent, 
string strKeyName)
{
string strResult = string.Empty;

if (webCurrent.Properties.ContainsKey(strKeyName))
{
strResult = webCurrent.Properties[strKeyName].ToString();
}
return strResult;
}
#endregion

Step by Step: Install SharePoint Foundation 2013 Preview

Written by Denis Stadler on . Posted in SharePoint 2013

Yesterday was a good day with important news from Microsoft. They announced the launch of the Office 2013 Customer Preview.

What happened in terms of Office Server a.k.a SharePoint? The answer is simple an it can be seen at the following links:

Before starting to watch the presentations, what I tried to do was to install SP 2013 Foundation Preview on a Windows 2012 Server RC Virtual Machine.


The first step was to download SharePoint 2013 Foundation and because I’m using a Hyper-V virtual machine, to change the extension of the downloaded file – SharePointFoundation_en-us_x64.img to .iso.

Before going further, I read the Hardware and software requirements for SharePoint 2013 Preview. What caught my attention is the following line: Development or evaluation installation of SharePoint Server 2013 Preview – 24 GB. Is this a mistake? Anyway I decided to go on with the installation on my virtual machine, which currently has 2GB of RAM. :)

So, let’s get started. My machine currently is in the default state (there are no roles and features installed on it).


First step is to install the software prerequisites. Click the Install software prerequisites link and then, in the newly opened window, the Next button.

Using SharePoint Online to Manage My Activity – Issues that I Have Experienced

Written by Denis Stadler on . Posted in Office 365

SharePoint Workspace 2010 doesn’t synchronize my document library

The common error message is: The query cannot be completed because the number of lookup columns it contains exceeds the lookup column threshold enforced by administrator.

From my searches on internet I found out that this is a common issue. It seems that there is a limitation for SharePoint Online saying that if there are more than 8 lookup columns in the document library, SharePoint Workspace won’t synchronize it.

The problem is that my document library has only 7 lookup columns.