11 Replies Latest reply: Oct 7, 2015 8:46 AM by RSS

    get list of all documents from a QVS

      We're building an application using the Qlikview OCX control. Opening documents on the server works just fine.


      axQlikOCX1.OpenDocument(@"qvp://company-qvs/Presentation/doc1.qvw", login, passwd);

      But we need to know the path to every document. We want to provide a list of available documents outside the OCX. So here's my questions: How do a get a list/array/etc. of documents from our server? Is there a way to fetch this via QVP?

      something like


      List<QlikView.Document> list = qvs.fetchDocumentList(@"qvp://company-qvs/Presentation/", login, passwd);
      List<QlikView.Document> list = qvs.fetchDocumentList(@"qvp://company-qvs/", login, passwd);

      whould be helpful.


        • get list of all documents from a QVS

          I forgot to mention, that fetching the document names/paths would be enough.

            • get list of all documents from a QVS
              Vlad Gutkovsky

              As far as I know there's no way to do this with OCX. However, 8.5 came with a useful file called QvDocList.js that is still included in 9.0 as a legacy file (see C:\Program Files\QlikView\Server\Legacy Files\Webpages\scripts). As demonstrated in this file, you can access the document list and path information through Javascript. I recommend that you do this recursively. The code might look something like this:


              var doc;
              if (window.ActiveXObject) {
              doc = new ActiveXObject ("Microsoft.XMLDOM");
              } else {
              doc = window.document.implementation.createDocument ("", "", null);

              for (var i = 0; i < doc.documentElement.childNodes.length; i++) {
              //Remove spaces in [ i ] parameter
              var path = doc.documentElement.childNodes[ i ].getAttribute ("Path");
              var name = doc.documentElement.childNodes[ i ].getAttribute ("Name");

              For more details, see the syntax within the file.

              Best regards,

                • get list of all documents from a QVS

                  Sounds fine, but how does this work together with the QlikView user management? What we are suppost do on our client side(C# .net app using the OCX)? We want to get only the List of documents for a specific user. If we access the server and a invoke the skript, does that works with an authentication?


                    • get list of all documents from a QVS
                      Vlad Gutkovsky

                      Oh ok, you didn't specify that you needed to check it against security permissions. I'm assuming that you're using NTFS authorization. If that's the case, pass the results of the Javascript function above to a function that checks NTFS permissions on the returned files. Then create a simple function that reduces the results and just shows the list of files for a specified user. Here is a good example of a function that checks NTFS permissions on a file: http://www.devx.com/cplus/Article/16711/1954. I found it very adaptable and should serve this purpose gracefully.

                • get list of all documents from a QVS

                  Add a reference to QvsNetRemote.dll in your C# project, add a listbox called lbDocs and try the following code, bye.

                  using QlikTech.NetClient;

                  QvClient client = new QvClient(txServer.Text.ToString(), QvClient.Mode.Admin);
                  XmlDocument answer = new XmlDocument();
                  //Retrieve document list
                  answer.LoadXml(client.Execute("<Global method='GetDocListEx'><Type>16</Type></Global>"));
                  XmlElement root = answer.DocumentElement;
                  XmlNodeList elemList = root.GetElementsByTagName("DisplayName");
                  XmlNodeList elemListPath = root.GetElementsByTagName("Path");
                  for (int i = 1; i < elemList.Count; i++)
                  if (elemListIdea.InnerXml.ToString().Trim() != "" && elemListPathIdea.InnerXml.ToString().Trim() != "")
                  XmlNode msg = answer.DocumentElement.SelectSingleNode("message/@text");
                  if (msg != null && msg.InnerText != string.Empty)
                  MessageBox.Show(this, msg.InnerText, "Error");