The SDK provides a Settings client to provide some extra utilities for retrieving settings.
Settings are entities that can be used with the querying client and the entities client. This client can be useful because it replaces some queries that would otherwise have to be manually written.
client variable in the following code examples refers to the
IMClient instance. When using the Web SDK, the variable name can be chosen freely, but it is also called
client at instantiation in the documentation.
Getting the category id
For example, the following snippet gets the id of the PortalConfiguration category:
long? id = await MClient.Settings.GetCategoryIdAsync("PortalConfiguration");
Getting a setting
For example, in the PortalConfiguration category, there is a setting named Authentication that can be retrieved using the following method:
IEntity setting = await MClient.Settings.GetSettingAsync("PortalConfiguration", "Authentication");
It is possible to pass an entity load configuration to the client.
Getting all the settings for a category
Getting all the settings for a category is also possible. For example, the following snippet gets all the rendition settings:
IList<IEntity> renditionSettings = await MClient.Settings.GetSettingsForCategoryAsync("Renditions");
It is possible to pass an entity load configuration.
Can we improve this article ? Provide feedback