You added some property settings to your custom property and created a couple of global settings for the editor to choose from. Then you find out you want to get hold of the setting values in code. Here's how you fetch them.

In my case it looks like this in the property global settings view in admin mode:

Admin Mode screenshot

The one I want to get the values from has the display name Avdelningar. Here's what I ended up with:

private PropertyFilteredRolesSettings GetPropertyFilteredRolesSettingsByName(string displayName)
    var p = new PropertySettingsRepository();
    var globals = p.GetGlobals(typeof(PropertyFilteredRolesSettings));

    foreach (var setting in globals)
        if (setting.DisplayName.Equals(displayName, StringComparison.OrdinalIgnoreCase))
            return ((PropertyFilteredRolesSettings) setting.PropertySettings);

    throw new Exception("Filtered Roles Settings Display Name Not Found");

// Usage example
var departmentSettings = GetPropertyFilteredRolesSettingsByName("Avdelningar");

if (Regex.Match("JustSomeRolename", departmentSettings.FilterRolesRegexPattern,

Added Tuesday 20 July 2010 10:03 — Tags for this page: Episerver, Development


Add Your Comment