Skip to main content Skip to complementary content

RemoteGetSourceDocumentNodes Method

Overloads

RemoteGetSourceDocumentNodes(Guid, Guid, Guid, String)

Connects to a remote QlikView Management Service and retrieves the source document nodes for the specified relative path and the specified source document folder and QlikView Distribution Service ID.

RemoteGetSourceDocumentNodes(Guid, Guid, Guid, String)

Connects to a remote QlikView Management Service and retrieves the source document nodes for the specified relative path and the specified source document folder and QlikView Distribution Service ID.

Declaration

      List<DocumentNode> RemoteGetSourceDocumentNodes(Guid remoteQmsId, Guid remoteQdsId, Guid folderId, string relativePath)
    

Parameters

Type Name Description
System.Guid remoteQmsId

The ID of the remote QlikView Management Service.

System.Guid remoteQdsId

The QlikView Disitribution Service ID for which to retrieve source document nodes.

System.Guid folderId

The source document folder ID for which to retrieve source document nodes.

System.String relativePath

The relative path for which to retrieve source document nodes.

Returns

Type Description
System.Collections.Generic.List<DocumentNode>

Source document nodes for the specified relative path and the specified source document folder and QlikView Distribution Service ID.

Remarks

This method is typically used to retrieve the source documents as a tree structure. Each returned DocumentNode contains a RelativePath property which describes where in the tree structure the node belongs. It also contains a IsSubFolder property that indicates whether the node represents a sub folder or a document.

To retrieve the first level of nodes under the source document root folder specified by folderId, set the relativePath parameter to an empty string. For deeper levels of nodes, set the relativePath parameter to a path combined of the relative path and the name of the parent node at the previous level.

The first level of nodes under each source document root folder will always contain a sub folder named <Orphans> that contains a folder structure of "ghost" source documents. Any such "ghost" source documents have at least one task assigned to it, but the document itself does no longer exist. Such "ghost" source documents will automatically disappear from the orphans structure when its tasks are removed or when the source document exist again. The source document node representing the orphans sub folder and all its sub nodes will have the IsOrphan property set to true.

Only source document folders that the caller have access to will be returned.

security

Requires membership of local group QlikView Management API and the role Document Folder Administrator.

Examples

The following code example uses the QMS API to retrieve a registered QlikView Distribution Service, all its source document folders and nodes. The GetSourceDocumentNodes(Guid, Guid, String) method is called recursively to print sub folders and source documents as a tree structure. If anything goes wrong, it prints an error message.

The service key injection is assumed to be handled behind the scenes. For an example of how to inject the service key, see Samples.

    using System;
using System.Collections.Generic;
using System.Linq;
using QMSAPI;

class Program
{
    static void Main(string[] args)
    {
        try
        {
            // create a QMS API client
            IQMS apiClient = new QMSClient();

            //retrieve a time limited service key
            ServiceKeyClientMessageInspector.ServiceKey = apiClient.GetTimeLimitedServiceKey();

            //Get a remote QlikView Management service.
            ServiceInfo remoteQMSService = apiClient.GetServices(ServiceTypes.RemoteQlikViewManagementService).FirstOrDefault();

            if (remoteQMSService != null)
            {
                //Get all QlikView Distribution services on the remote QMS.
                List<ServiceInfo> remoteQDS = apiClient.RemoteGetServices(remoteQMSService.ID, ServiceTypes.QlikViewDistributionService);
                {
                    //Print the name of the QMS and the source folders found.
                    remoteQDS.ForEach(delegate(ServiceInfo qdsInfo)
                        {
                            Console.WriteLine("Document structures on " + qdsInfo.Name);

                            List<DocumentFolder> sourceDocumentFolders = apiClient.RemoteGetSourceDocumentFolders(remoteQMSService.ID, qdsInfo.ID, DocumentFolderScope.All);
                            sourceDocumentFolders.ForEach(delegate (DocumentFolder folder)
                                {
                                    PrintSourceDocumentNodes( apiClient, remoteQMSService.ID, folder, string.Empty, 1);
                                }
                            );
                        }
                    );
                }
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine("An exception occurred: " + ex.Message);
        }
        // wait for user to press any key
        Console.ReadLine();
    }


    static void PrintSourceDocumentNodes(IQMS apiClient, Guid remoteQmsId,DocumentFolder sourceDocumentFolder, string relativePath, int indentationDepth)
    {
        // retrieve all source document nodes of the given folder and under the specified relative path
        List<DocumentNode> sourceDocumentNodes = apiClient.RemoteGetSourceDocumentNodes(remoteQmsId, sourceDocumentFolder.Services.QDSID, sourceDocumentFolder.ID, relativePath);

        // loop through all current source document nodes
        foreach (DocumentNode sourceDocumentNode in sourceDocumentNodes
            .OrderByDescending(x => x.IsSubFolder).ThenBy(x => x.Name))
        {
            // print the names of all source document nodes, indent and
            // prefix with [F] for folders and [D] for documents
            string indentation = new string(' ', indentationDepth * 3);
            string nodePrefix = (sourceDocumentNode.IsSubFolder ? "[F]" : "[D]");
            Console.WriteLine(indentation + nodePrefix + " " + sourceDocumentNode.Name);
            // print all sub nodes of the current source document node if it represents a folder
            if (sourceDocumentNode.IsSubFolder)
            {
                PrintSourceDocumentNodes(apiClient, remoteQmsId, sourceDocumentFolder,
                    relativePath + "\\" + sourceDocumentNode.Name, indentationDepth + 1);
            }
        }
     }
}
  

Exceptions

Type Condition
System.Exception

Thrown if the caller does not have access to the source document folder with the specified ID.

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!

Join the Analytics Modernization Program

Remove banner from view

Modernize without compromising your valuable QlikView apps with the Analytics Modernization Program. Click here for more information or reach out: ampquestions@qlik.com