Skip to main content

Listing sheets in an app

This topic describes how to list the sheets in a Qlik Sense app.

Example: List sheets in a Qlik Sense app

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())
    {
        IApp application = location.App(appIdentifier);
        if (appIdentifier.AppName == "My app")
        {
            ISheetList sheetList = application.GetSheetList();
            foreach (ISheetObjectViewListContainer item in sheetList.Layout.AppObjectList.Items)
            {
                Console.WriteLine(item.Data.Title);
            }
            break;
        }
    }
    // Keep console window open to see sheets
    Console.ReadLine();
}

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!