Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
mertkabakoglu
Contributor II
Contributor II

Qlik sense .Net SDK app theme name

Hello Everyone, We're using Qlik Sense .Net SDK (14.1.0) in .Net Core 3.0. We need to get  theme name of selected qliksense app but we can't find any solution. Does anyone know how to get theme name of qliksense app with .Net Core 3.0.

5 Replies
Øystein_Kolsrud
Employee
Employee

Information about the theme can be found in the "app properties object" used by the client to store certain client-specific info about the app. You can see it if you use the "Qlik Explorer for Developers" tool:

https://help.qlik.com/en-US/sense-developer/April2020/Subsystems/Plugins/Content/Sense_Plugins/Getti...

You'll see it as an entry titled "App client properties" in the subtree of an app.

Getting hold of that object programatically is a little convoluted as you'll first have to create an app object list to get the objects' ID. Like this:

 

var listProps = new GenericObjectProperties{Info = new NxInfo{Type = "mylist"}};
var listDef = new AppObjectListDef { Type = "appprops" };
listProps.Set("qAppObjectListDef", listDef);
var list = app.CreateGenericSessionObject(listProps);
var objId = list.Layout.Get<AppObjectList>("qAppObjectList").Items.First().Info.Id;
app.DestroyGenericSessionObject(list.Id);

 

Then once you have that ID, then you can get the theme ID used like this:

 

var obj = app.GetGenericObject(objId);
var themeId = obj.Properties.Get<string>("theme");
Console.WriteLine("Theme id: " + themeId);

 

So now we have the theme id. If you want to get the name of the id, then you'll have to get the correct information from Qlik Sense. I used this endpoint, but I'm not sure if that will also give you information about custom themes:

/resources/assets/external/sense-themes-default/default-themes.json

Here's code for getting that using this library: https://www.nuget.org/packages/QlikSenseRestClient/

 

var restClient = new RestClient(url);
restClient.AsNtlmUserViaProxy();
var themes = JObject.Parse(restClient.Get("/resources/assets/external/sense-themes-default/default-themes.json"));
Console.WriteLine(themes);

 

mertkabakoglu
Contributor II
Contributor II
Author

Theme ıd solved my issue thank you for solution.

SohaibShaheen2
Contributor
Contributor

Can you please tell us how you found out the solution, i am also looking to save theme name in variable but could find any solution yet

ar5
Partner - Contributor III
Partner - Contributor III

@Øystein_Kolsrud I'm creating a new app using .net SDK:
appEntry = location.CreateAppWithName(appName);
It gets a default theme "Sense Horizon". How can I modify it to "Sense Classic" using c#? I have tried app.SetAppProperties() that has no theme property

ar5_0-1713362809600.png

 

Øystein_Kolsrud
Employee
Employee

I've never tried it myself, but I think it's all about modifying that "theme" property of the "approps" object. Check out the initial response to this thread on how to get it. Once you know the ID of the "approps" object and the theme you want, you should be able to do something like this:

var obj = app.GetGenericObject(objId);
using (obj.SuspendedLayout)
{
    obj.Properties.Set("theme", "<new theme id>");
}