# ImportDocumentTask Method

## Overloads

| [ImportDocumentTask(Guid, Guid, Guid, DocumentNode)](https://help.qlik.com/en-US/qlikview-developer/September2026/Subsystems/QMSAPIref/Content/PIX.Services.V12.Api5.IQMS5.ImportDocumentTask.htm#PIX_Services_V12_Api5_IQMS5_ImportDocumentTask_System_Guid_System_Guid_System_Guid_PIX_QMSAPI_DataObjects_DocumentNode_) |  | Imports a single document task from a remote QlikView Distribution Server. |
| --- | --- | --- |

[](https://help.qlik.com/en-US/qlikview-developer/Subsystems/QMSAPIref/Content/PIX.Services.V12.Api5.IQMS5.ImportDocumentTask.htm) [](https://help.qlik.com/en-US/qlikview-developer/Subsystems/QMSAPIref/Content/PIX.Services.V12.Api5.IQMS5.ImportDocumentTask.htm)

## ImportDocumentTask(Guid, Guid, Guid, DocumentNode)

Imports a single document task from a remote QlikView Distribution Server.

### Declaration

```

          void ImportDocumentTask(Guid remoteQmsId, Guid remoteDocumentTaskId, Guid destinationQdsId, DocumentNode destinationDocument)
    
  
```

### Parameters

| Type | Name | Description |
| --- | --- | --- |
| System.Guid | remoteQmsId | The ID of the remote QMS. |
| System.Guid | remoteDocumentTaskId | The ID of the remote task to be imported. |
| System.Guid | destinationQdsId | The ID of the QDS to which the task is to be imported. |
| [DocumentNode](https://help.qlik.com/en-US/qlikview-developer/September2026/Subsystems/QMSAPIref/Content/PIX.QMSAPI.DataObjects.DocumentNode.htm) | destinationDocument | The document to import the task to. |

### Remarks

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

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.

```
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();
    }
}
```