How to access a resource file that's not in the root of the Resources folder? (Sharepoint 2010)

StackOverflow https://stackoverflow.com/questions/20755950

문제

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", "GlobalResources", language);


However, to follow company coding standards, I am required to move the resources file into a folder named <client>.<department>.<project>.<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...

(a)

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

(b)

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

(c)

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?

도움이 되었습니까?

해결책

I received an answer to this question here.

This worked:

string resourceVal = SPUtility.GetLocalizedString("$Resources:ResourceKey",
"Comp.Dept.Proj.Farm\\GlobalResources", language);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top