# Create a New Fetch Task

To automatically retrieve content from Lync or OCS, create a new fetch task by following these steps. The connector runs each fetch task automatically, based on the schedule that is configured in the configuration file.

To create a new fetch task

1. Stop the connector.
2. Open the connector configuration file in a text editor.

3. In the `[Connector]` section, set the `OperatingMode` parameter to one of the following values:

   `LyncConnector` | Retrieve messages from a Lync server.
   `OCSConnector` | Retrieve messages from an Office Communications Server.
   `GroupChatConnector` | Retrieve group chat messages archived by a Lync GroupChat server or Office Communications Server.

   For example:

       [Connector]
       EnableIngestion=True
       ...
       OperatingMode=GroupChatConnector

4. In the `[FetchTasks]` section of the configuration file, specify the number of fetch tasks using the `Number` parameter. If you are configuring the first fetch task, type `Number=1`. If one or more fetch tasks have already been configured, increase the value of the `Number` parameter by one (1). Below the `Number` parameter, specify the names of the fetch tasks, starting from zero (0). For example:

       [FetchTasks]
       Number=1
       0=MyTask

   NOTE: The fetch tasks that you configure are run in sequence. If you want to run tasks in parallel, set the `TaskThreads` parameter.

5. Below the `[FetchTasks]` section, create a new TaskName section. The name of the section must match the name of the new fetch task. For example:

       [FetchTasks]
       Number=1
       0=MyTask

       [MyTask]

6. In the new section, set the following parameters:

   `DbConnectionString` | The connection string to use to connect to the archiving database for the Lync Server or Office Communications Server. For example: `DbConnectionString=DSN=dsnname;UID=user;PWD=password` Alternatively, use the format `DbConnectionString=Driver=SQL Server;Server=ServerName\ARCHIVE;Database=LcsLog;UID=user;PWD=password`
   `IntervalSeconds` | The interval of time to process (in seconds). When the connector runs the task, it retrieves any conversation that is complete and within the interval. The interval begins from the time of the most recent message that has been retrieved.
   `ChatExpirySeconds` | (Optional) The number of seconds of inactivity required before a conversation, group chat, or conference is considered to be complete.
   `XmlTransformXslFilename` | (Optional) The path to an XSL file to use for formatting documents before they are sent to CFS. If you want to use different XSL files based on the conversation type, you can set the following parameters: `ConfXmlTransformXslFilename` `ConvXmlTransformXslFilename` `ChatXmlTransformXslFilename`

   For example:

       [MyTask]
       DbConnectionString=DSN=myDSN;UID=user;PWD=password
       IntervalSeconds=6000
       ChatExpirySeconds=1800
       XmlTransformXslFilename=my_xsl.xsl

   For a complete list of parameters that you can use to customize the Lync Connector, refer to the Lync Connector (CFS) Reference.

7. Save and close the configuration file. You can now start the connector.

   NOTE: The connector saves or updates a data file for each completed fetch task. If you make changes to the configuration and want to reset the connector so that it retrieves all of your data again, you can use the `PurgeDatastore` action.

_FT_HTML5_bannerTitle.htm