Listing available apps
This topic shows how to list all available Qlik Sense apps. The following example contains all the code you need to make a direct connection to the engine and list the apps. This example requires a client certificate.
Example: List all available apps
static void Main(string[] args)
{
// locate the client certificate and accept it as trusted
X509Certificate2 x509 = new X509Certificate2();
//Create X509Certificate2 object from .pem file.
byte[] rawData = File.ReadAllBytes(@"C:\ProgramData\Qlik\Sense\Repository\Exported Certificates\.Local Certificates\client.pem");
x509.Import(rawData, "Qlik2Run", X509KeyStorageFlags.UserKeySet);
X509Certificate2Collection certificateCollection = new X509Certificate2Collection(x509);
//Defining the location as a direct connection to Qlik Sense Server
//The default portnumber is 4747 but can be customized
var uri = new Uri("https://server.com:4747");
ILocation location = SetupConnection(uri);
location.AsDirectConnection("domain", "user", certificateCollection: certificateCollection);
DoTask(location);
}
static ILocation SetupConnection(Uri uri)
{
ILocation location = Qlik.Engine.Location.FromUri(uri);
return location;
}
static void DoTask(ILocation location) { foreach (IAppIdentifier appIdentifier in location.GetAppIdentifiers()) { Console.WriteLine(appIdentifier.AppName); } // Keep console window open to see apps Console.ReadLine(); }