in SharePoint 2010

SharePoint 2010: Working with Resource Files

If you are working with multi-lingual SharePoint deployments, then you will end up working with Resource files in your SharePoint projects. Resource files (.resx) helps developers to create and manage localizable content.

Let us see how you can make use of the resource files in your SharePoint projects using Visual Studio 2010.

Add a Resource File (.resx)

First, you need to add a SharePoint mapped folder – Resources – to your project:


The Resources folder (C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14Resources) is where SharePoint manages and loads the resource files.


Right click on the Resources folder and add a new item – Resources File


This will add the .resx file to Resources folder which means that this will be deployed to the mapped Resources folder


Now, you can add strings to this resource file.

Using Resource Strings

Now that you have a resources file, it is very simple to use the resource strings in CAML and code


<Field ID="{1b49fd88-9aac-4b9c-add6-8497cac1fb8a}"
    Group="Chaks Sample Fields" />

The format being:

$Resources: <resource-file-name-without-extension>, <resource-string-name>

In Code:

We use the SPUtility.GetLocalizedString


Using Resource Strings in Features

What about features?

Set the Default Resource File to your resources file (.resx) file:


You can also control the visibility of the feature depending on whether resources are available in the language by setting the RequireResources property:


Now, you can can reference your resource in the Feature properties:


Sample Solution

You can download the sample solution here.

Write a Comment


  1. Hi Chak, any particular reason why you prefer to specify a global resource file for the feature resources rather than rely on the feature default resource file (feature, right-click, Add Feature Resource)?

    Is it possible to use the feature default resource file (feature, right-click, Add Feature Resource) for resources in the feature event receivers code? AFAIK it is not, you need a global resource file for that. Is that why you prefer the global resource file?