Skip to main content

Official Support Articles

Search or browse our knowledge base to find answers to your questions ranging from account questions to troubleshooting error messages. The content is curated and updated by our global Support team

Announcements
CUSTOMERS ONLY: Now accepting customer applications for the 2023 Luminary Program: SUBMIT NOW

Qlik Sense: Getting started with the .NET SDK

cancel
Showing results for 
Search instead for 
Did you mean: 
Damien_Villaret
Support
Support

Qlik Sense: Getting started with the .NET SDK

This article explains how to get started with the .NET SDK

The following must be installed to test the example provided in this article:

  • Microsoft Visual Studio (The community version can be used)
  • Qlik Sense Server


*It does not need to be installed on the same machine, but proper ports must be open for incoming connection on the Qlik Sense server side.

Please also make sure that the user connecting from the .NET SDK has a license assigned

Environments:

Qlik Sense Enterprise any version
 

 

Resolution:

 

  1. Open Visual Studio and create a new project. In this example, we have selected "Console App (.NET Framework)"
  2. Go to Tools > NuGet Package manager > Package Manager Console
  3. Use "Install-Package QlikSense.NetSDK" to install the latest version of the SDK or "Install-Package QlikSense.NetSDK -Version x.x.x" to install a specific version (It must match the Qlik Sense server version). Go to https://www.nuget.org/packages/QlikSense.NetSDK/ to find the correct command for your version if you are unsure.
  4. Once the package is installed, it will appear in the References for your project. We can create a small program with the following code to connect to the Qlik Sense server and show Product version, OS Name and OS Version.

          In the below program, we are using Windows authentication, so we have to use the AsNtlmUserViaProxy function to specify that we want to use Windows authentication.

If the connection is done through https, the certificate on the proxy must be trusted (You have to install root.cer in the "Trusted root certificate authorities" certificate store on the machine that is making the API call)

 

// using System, etc. 
using Qlik;
using Qlik.Engine;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Uri uri = new Uri("https://qlikserver3.domain.local/");
            ILocation location = Qlik.Engine.Location.FromUri(uri);
            location.AsNtlmUserViaProxy(proxyUsesSsl: true);
            using (var hub = location.Hub())
            {
                Console.WriteLine("Product Version: " + hub.ProductVersion());
                Console.WriteLine("OS Name:    " + hub.OSName());
                Console.WriteLine("OS Version: " + hub.OSVersion());
                Console.WriteLine("Press enter to close...");
                Console.ReadLine();
            }
        }
    }
}

 

  • This should show something like this:

Product Version: 3.2.3
OS Name: WindowsNT
OS Version: 6.2.9200
Press enter to close...

 

Connect to an app:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Qlik;
using Qlik.Engine;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Uri uri = new Uri("https://qlikserver1.domain.local/");
            ILocation location = Qlik.Engine.Location.FromUri(uri);
            location.AsNtlmUserViaProxy(proxyUsesSsl: true);
            IAppIdentifier appIdentifier = location.AppWithId("03bbedf2-2c45-4e10-bf5a-fded0c21cda8");
            using (var app = location.App(appIdentifier))
            {
                var layout = app.GetAppLayout();
                Console.WriteLine(layout.Title + " [" + app.Type + "]");
                Console.ReadLine();
            }
        }
    }
}


Result:
Test1 [Doc]


Tip: If the program does not run, try to build it and execute the .exe file from the Qlik Sense server. If that works locally from the server itself, it might be that there is a network device that is not allowing the connection or the proper ports are not open.

Labels (1)
Version history
Last update:
‎2021-02-23 04:31 AM
Updated by:
Contributors