How to use Role Definitions across Multiple Language MOSS Versions - Clean Approach

The problem with Multi-Language MOSS is that the name of the Role Definition is localized hence if you have a common code running on multiple MOSS versions, you can't use the name of the SP Role Definition. An easier way could be to use the Role Definition's ID which is constant across languages.

But I tried to find out a more cleaner way of doing this and found a method to achieve so.

SPSite site = new SPSite("https://SiteCollectionURL:14995");
SPWeb web = site.OpenWeb();
SPRoleDefinition def = web.RoleDefinitions.GetByType(SPRoleType.Administrator); // For Full Control
SPRoleDefinition def1 = web.RoleDefinitions.GetByType(SPRoleType.Contributor);  // For Contribute
SPRoleDefinition def2 = web.RoleDefinitions.GetByType(SPRoleType.Guest);         // For Limited Access
SPRoleDefinition def4 = web.RoleDefinitions.GetByType(SPRoleType.Reader);        // For Read
SPRoleDefinition def5 = web.RoleDefinitions.GetByType(SPRoleType.WebDesigner);     //For Design

Comments