I followed this tutorial to create a resource file named GlobalResources.resx under Resources.

Resources file in root

I am able to access the content of the resource file using:

string resourceVal = SPUtility.GetLocalizedString("$Resources:GlobalResources, ResourceKey", 
"GloablResources", language);

However, to follow company coding standards, I am required to move the resources file into a folder named <client>.<project>.<department>.<farm|sandbox>.
So I did this:

Resource file in sub-folder

But now I'm not able access the resource values!

I tried the following...


SPUtility.GetLocalizedString("$Resources:Comp.Dept.Proj.Farm/GlobalResources, ResourceKey", 
"Comp.Dept.Proj.Farm/GlobalResources", language);


SPUtility.GetLocalizedString("$Resources:Comp.Dept.Proj.Farm\\GlobalResources, ResourceKey", 
"Comp.Dept.Proj.Farm\\GlobalResources", language);


SPUtility.GetLocalizedString("$Resources:Comp.Dept.Proj.Farm.GlobalResources, ResourceKey", 
"Comp.Dept.Proj.Farm.GlobalResources", language);

...but none of them worked.

How do I access the resource file that's not in the root of the Resources folder?

SPUtility.GetLocalizedString("$Resources:YourKeyValue", "Comp.Dept.Proj.Farm\\GloablResources", 1033);

plz refer this link http://geekswithblogs.net/venkatx5/archive/2010/12/14/how-to-create-multilingual-webpart-in-sharepoint-2010.aspx


did you try this $Resources:Comp.Dept.Proj.Farm\GlobalResources or $Resources:`/Comp.Dept.Proj.Farm/GlobalResources?

also check this msdn for http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.utilities.sputility.getlocalizedstring.aspx

check this guy http://blogs.msdn.com/b/joshuag/archive/2009/03/07/using-resource-files-resx-when-developing-sharepoint-solutions.aspx


The folder becomes part of the namespace. I think you are almost there with option c), but as first parameter write the key "$Resources: ResourceName".

For example if in the resource file you have key-value pair with name = "MyFieldName" and value="MyField" then this should work:

SPUtility.GetLocalizedString("$Resources:MyFieldName", "Comp.Dept.Proj.Farm.GloablResources", language);

And don't forget to run copyappbincontent command.

  • Thanks for the asnwer, but sorry, specifying the resource filename as Comp.Dept.Proj.Farm.GlobalResources didn't work for me. Instead, Comp.Dept.Proj.Farm\\GlobalResources did. – SNag Dec 24 '13 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.