Click or drag to resize
IQMS2ImportDocumentTask Method
Imports a single document task from a remote QlikView Distribution Server.

Namespace: PIX.Services.V12.Api2
Assembly: 
Syntax
void ImportDocumentTask(
	Guid remoteQmsId,
	Guid remoteDocumentTaskId,
	Guid destinationQdsId,
	DocumentNode destinationDocument
)

Parameters

remoteQmsId
Type: SystemGuid
The ID of the remote QMS.
remoteDocumentTaskId
Type: SystemGuid
The ID of the remote task to be imported.
destinationQdsId
Type: SystemGuid
The ID of the QDS to which the task is to be imported.
destinationDocument
Type: PIX.QMSAPI.DataObjectsDocumentNode
The document to import the task to.
Remarks

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

Security note Security Note

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

Examples
In the example below, a list of tasks is retrieved for a known source document on a remote QlikView Management Service. Each task is imported to a document on the "local" QMS.

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

C#
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();

            //Find a the remote QMS service.
            ServiceInfo remoteQMSService = apiClient.GetServices(ServiceTypes.RemoteQlikViewManagementService).FirstOrDefault();

            //Find a local QDS service
            ServiceInfo localQDS = apiClient.GetServices(ServiceTypes.QlikViewDistributionService).FirstOrDefault();

            //Get the tasks of a remote document.
            Guid remoteDocId = new Guid ("12a32214-1122-112a-8099-8765ce564112"); // The remote document ID.
            List<TaskInfo> taskInfos = apiClient.RemoteGetTaskListForDocID(remoteQMSService.ID, remoteDocId);

            //Get a local document.
            Guid localDocId = new Guid("c7c66836-f00b-47c4-8099-23ff7f178423"); // The local document ID.
            DocumentNode destinationDocument = apiClient.GetSourceDocuments(localQDS.ID).Where(dn => dn.ID == localDocId).FirstOrDefault();

            if (destinationDocument != null)
            {
                //Apply each remote task on the local document.
                foreach(TaskInfo taskInfo in taskInfos) {
                    apiClient.ImportDocumentTask(remoteQMSService.ID, taskInfo.ID, localQDS.ID, destinationDocument);
                }
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine("An exception occurred: " + ex.Message);
        }
        // wait for user to press any key
        Console.ReadLine();
    }
}
See Also