API Questions on Kentico API.
Version 6.x > API > Custom Settings View modes: 
User avatar
Member
Member
positivepurchasing - 4/27/2012 10:26:37 AM
   
Custom Settings
How to I get the custom settings?

Is there a namespace? a context? anything?

User avatar
Member
Member
positivepurchasing - 4/27/2012 10:55:26 AM
   
RE:Custom Settings
Also how do I remove a setting???

Please point in the direction of some developer info so I can learn something. I am struggling with Kentico as I am new to Kentico.

I just don't understand the Kentico way of thinking / doing things.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 4/27/2012 5:52:45 PM
   
RE:Custom Settings
Hi,

Have you already seen the API Examples available in Site Manager -> Support -> API examples section? There are also examples how to manage the settings keys.

I hope it'll help.

Best regards,
Juraj Ondrus

User avatar
Member
Member
positivepurchasing - 10/10/2012 9:37:23 AM
   
RE:Custom Settings
Hi Juraj

I still cannot retrieve custom settings.

In SiteManager>Development>CustomSettings I have created a new category called 'SagePay' and created a new settings key called 'CMSSagePaySuccessUrl' which is a string.

I have tried 'SettingsKeyProvider.GetStringValue("CMSSagePaySuccessUrl")' but this returns null. Does the category matter?

Please show me how to retrieve this value. I cannot find any useful info in the documentation.

Cheers
Paul.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 10/15/2012 3:28:28 AM
   
RE:Custom Settings
Hi,

Are you following the API examples?
Have you tried using the site ID in the GetStringValue method? The setting you have created may be site specific and not global:

SettingsKeyInfo updateKey = SettingsKeyProvider.GetSettingsKeyInfo("MyNewKey", CMSContext.CurrentSiteID);

Best regards,
Juraj Ondrus

User avatar
Member
Member
positivepurchasing - 10/15/2012 3:56:13 AM
   
RE:Custom Settings
Hi,

I've done this which works OK.
SettingsKeyInfo getSettingsKeyInfo(string keyName)
{
SettingsKeyInfo settingsKeyInfo = SettingsKeyProvider.GetSettingsKeyInfo(keyName, CMSContext.CurrentSiteID);

if (settingsKeyInfo == null || settingsKeyInfo.KeyValue == null)
{
settingsKeyInfo = SettingsKeyProvider.GetSettingsKeyInfo(keyName);
}

return settingsKeyInfo;
}

Cheers
Paul