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