Get a Localized String From SharePoint Application Resources


At the begging of any SharePoint I used to configure our project to deploy a resources files to APP_GlobalResources folder of our application virtual directory used by IIS.

You can’t simply do this using visual studio. You can do a lot of workarounds to make this work for you because visual studio don’t allow you to deploy resources files directly to APP_GlobalResources, it allows you only to deploy these files to application resources which found on 14 hive\Resources.

There is no problem where to deploy it but I have to add it to APP_GlobalResources to use it like the same way I use it in ASP.NET

Today I discover there is a smiple solution, I can use it directly from the 14 hive based on a SharePoint utility method called SPUtility.GetLocalizedString(), so I implement a method as following to do this:

public static string GetResource(string key, string resourceFileName)
return SPUtility.GetLocalizedString(“$Resources:”+key,resourceFileName,(uint)System.Threading.Thread.CurrentThread.CurrentUICulture.LCID);


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s