private static void CheckConnection(QSApp TheQS) { // Connects a QSApp object with the default values TheQS.qsAppName = cntqsAppName; TheQS.qsAppId = cntqsAppId; TheQS.qsServer = cntqsServer; TheQS.qsSingleServer = cntqsSingleServer; TheQS.qsSingleApp = cntqsSingleApp; TheQS.qsAlternativeStreams = cntqsAlternativeStreams; try { // Create or use the Telegram UserID as the Qlik Sense UserID // With the bot virtual proxy and user directory // The Virtual Proxy has to be created as "Header authentication static user directory" // The user directory is defined in the Virtual Proxy, in "Header authentication static user directory" // For this example: // // Qlik Sense Virtual Proxy // ------------------------ // // Description: Telegram // Prefix: telegram // Timeout: 30 // Session cookie header name: X-Qlik-Session-telegram // Anonymous access mode: No anonymous user // Authentication method: Header authentication static user directory // Header authentication header name: X-Qlik-HeaderAuthTelegram // Header authentication static user directory: TELEGRAM // // PD.- Do not forget to add the server node, link the proxy and include the server name in the white list TheQS.QSConnectServerHeader("User1", "Qlik Sense Header Auth is Here", cntqsServerVirtualProxy, cntqsServerSSL, true); if (TheQS.IsConnected) { TheQS.QSOpenApp(); if (TheQS.AppIsOpen) { Console.WriteLine(string.Format("Opened the Qlik Sense app: {0} for user {1} ({2})", cntqsAppId, "User1", cntqsServerVirtualProxy)); string Val = TheQS.GetExpression("Sum([Sales Amount])"); Console.WriteLine("Value: " + Val); } } } catch (Exception e) { Console.WriteLine(string.Format("Error opening the Qlik Sense app: {0} for user {1} ({2}): {3}", cntqsAppId, "User1", cntqsServerVirtualProxy, e)); } }
private static void Connect(QSApp TheQS, string UserId, string VirtualProxyPath = "", bool UseSSL = true) { // Connects a QSApp object try { // Create or use the Telegram UserID as the Qlik Sense UserID // With the bot virtual proxy and user directory // The Virtual Proxy has to be created as "Header authentication static user directory" // The user directory is defined in the Virtual Proxy, in "Header authentication static user directory" // For this example: // // Qlik Sense Virtual Proxy // ------------------------ // // Description: Telegram // Prefix: telegram // Timeout: 30 // Session cookie header name: X-Qlik-Session-telegram // Anonymous access mode: No anonymous user // Authentication method: Header authentication static user directory // Header authentication header name: X-Qlik-HeaderAuthTelegram // Header authentication static user directory: TELEGRAM // // PD.- Do not forget to add the server node, link the proxy and include the server name in the white list TheQS.QSConnectServerHeader(UserId, "X-Qlik-HeaderAuthTelegram", VirtualProxyPath, UseSSL, true); if (TheQS.IsConnected) { TheQS.QSOpenApp(); if (TheQS.AppIsOpen) { Console.WriteLine(string.Format("Opened the Qlik Sense app: {0} for user {1} ({2})", TheQS.qsAppId, UserId, VirtualProxyPath)); //string Val = TheQS.GetExpression("Sum([Sales Amount])"); //Console.WriteLine("Value: " + Val); } } } catch (Exception e) { Console.WriteLine(string.Format("Error opening the Qlik Sense app: {0} for user {1} ({2}): {3}", TheQS.qsAppId, UserId, VirtualProxyPath, e)); } }