Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Read

Reads a file from directory.

Task version: 1.3.0

Required Frends version: 5.7+

Required .NET version: 8.0

Compatible Agents: Crossplatform

Task Parameters

Name
Description

Path : String

Full path of the target file to be read.

Default: - Example: c:\temp\foo.txt

Name
Description

UseGivenUserCredentialsForRemoteConnections : Boolean

If set, allows you to give the user credentials to use to delete files on remote hosts.

If not set, the agent service user credentials will be used.

Note: This feature is only possible with Windows agents.

Default: False Example: true

UserName : String

This needs to be of format domain\username

Default: "domain\username" Example: domain\username

🗝Password : String

Password for the used credentials.

Default: - Example: testpwd

FileEncoding : FileEncoding

Encoding for the written content. By selecting 'Other' you can use any encoding.

Possible values:

  • UTF8: Encoding for the written content. By selecting 'Other' you can use any encoding.

  • Default: Encoding for the written content. By selecting 'Other' you can use any encoding.

  • ASCII: Encoding for the written content. By selecting 'Other' you can use any encoding.

  • Unicode: Encoding for the written content. By selecting 'Other' you can use any encoding.

  • Windows1252: Encoding for the written content. By selecting 'Other' you can use any encoding.

  • Other: Encoding for the written content. By selecting 'Other' you can use any encoding.

Default: UTF8 Example: FileEncoding.UTF8

EnableBom : Boolean

Enable BOM for UTF-8

Default: False Example: true

EncodingInString : String

File encoding to be used. A partial list of possible encodings: https://en.wikipedia.org/wiki/Windows_code_page#List

Default: - Example: ISO-8859-2

ThrowErrorOnFailure : Boolean

Whether to throw an error on failure.

Default: True Example: true

ErrorMessageOnFailure : String

Overrides the error message on failure. If ThrowErrorOnFailure is set to true, then the original exception will be wrapped in a new Exception with this error message.

Default: - Example: Reading the file failed: file is missing

Task Result

Name
Description

Success : Boolean

Indicates whether the operation completed successfully. Example: true

Error : Error

Error details. Null when Success is true. Example: null

Error.Message : String

Summary of the error. Example: Could not find file 'c:\temp\foo.txt'.

Error.AdditionalInfo : Exception

The exception that caused the error. Example: System.IO.FileNotFoundException: Could not find file 'c:\temp\foo.txt'.

Content : String

File content. Example: This is a test file.

Path : String

Full path to the file. Example: c:\temp\foo.txt

SizeInMegaBytes : Double

Size of the written file in mega bytes. Example: 32

SizeInKiloBytes : Double

Size of the written file in kilo bytes. Example: 32

SizeInBytes : Double

Size of the written file in bytes. Example: 32

CreationTime : DateTime

DateTime when file was created. Example: 01/31/2023 10:54:17

LastWriteTime : DateTime

DateTime for last write time of the file. Example: 02/06/2023 09:59:13

Task Changelog

Changelog for Task Frends.Files.Read.

[1.3.0] - 2026-10-09

Changed

  • Upgraded the Task to target .NET 8.

  • The Task now throws an error on failure by default. Set ThrowErrorOnFailure to false in Options to receive a result with Success set to false and error details in Error instead.

Added

  • Added Success and Error properties to the result.

  • Added ThrowErrorOnFailure and ErrorMessageOnFailure options.

[1.2.0] - 2025-03-19

Changed

  • Update packaged: Microsoft.Extensions.FileSystemGlobbing 7.0.0 -> 9.0.3 System.ComponentModel.Annotations 4.7.0 -> 5.0.0 System.DirectoryServices 7.0.0 -> 8.0.0 coverlet.collector 3.1.0 -> 6.0.4 Microsoft.NET.Test.Sdk 16.6.1 -> 17.13.0 MSTest.TestAdapter 2.2.7 -> 3.8.3 MSTest.TestFramework 2.2.8 -> 3.8.3 nunit 3.12.0 -> 4.3.2 NUnit3TestAdapter 3.17.0 -> 5.0.0

[1.1.0] - 2024-10-14

Fixed

  • Fixed documentation for Path parameter.

Added

  • Added Windows1252 encoding to the FileEncoding enum.

  • Added different sizes to the Task result.

[1.0.0] - 2023-02-28

Added

  • Initial implementation

Last updated

Was this helpful?