Using MOSS internal resources

Sometimes you may want to use standard MOSS resource strings that are not found in .resx files in the 12-hive or wwwroot. These strings can reside as compiled resources inside the SharePoint assemblies. Here are two helper functions to extract those resource strings.

[code lang=”csharp”]
private static string publishingAssemblyString = "Microsoft.SharePoint.Publishing.intl, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c";
private static string officeServerAssemblyString = "Microsoft.Office.Server.intl, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c";

public static string GetPublishingResource(CultureInfo info, string key)
Assembly assembly = Assembly.Load(publishingAssemblyString);
ResourceManager rm = new ResourceManager("Microsoft.SharePoint.Publishing.Strings", assembly);
return rm.GetString(key, info);

public static string GetOfficeServerResource(CultureInfo info, string key)
Assembly assembly = Assembly.Load(officeServerAssemblyString);
ResourceManager rm = new ResourceManager("Microsoft.Office.Server.Strings", assembly);
return rm.GetString(key, info);

Tags: ,

Leave a Reply">Entries (RSS) and Comments (RSS).