Share via


BatchClient.GetTaskFilesAsync Method

Definition

Overloads

GetTaskFilesAsync(String, String, Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, String, Nullable<Boolean>, RequestContext)

[Protocol Method] Lists the files in a Task's directory on its Compute Node.

GetTaskFilesAsync(String, String, Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, String, Nullable<Boolean>, CancellationToken)

Lists the files in a Task's directory on its Compute Node.

GetTaskFilesAsync(String, String, Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, String, Nullable<Boolean>, RequestContext)

Source:
BatchClient.cs

[Protocol Method] Lists the files in a Task's directory on its Compute Node.

public virtual Azure.AsyncPageable<BinaryData> GetTaskFilesAsync (string jobId, string taskId, int? timeOutInSeconds, DateTimeOffset? ocpdate, int? maxresults, string filter, bool? recursive, Azure.RequestContext context);
abstract member GetTaskFilesAsync : string * string * Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * string * Nullable<bool> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
override this.GetTaskFilesAsync : string * string * Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * string * Nullable<bool> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
Public Overridable Function GetTaskFilesAsync (jobId As String, taskId As String, timeOutInSeconds As Nullable(Of Integer), ocpdate As Nullable(Of DateTimeOffset), maxresults As Nullable(Of Integer), filter As String, recursive As Nullable(Of Boolean), context As RequestContext) As AsyncPageable(Of BinaryData)

Parameters

jobId
String

The ID of the Job that contains the Task.

taskId
String

The ID of the Task whose files you want to list.

timeOutInSeconds
Nullable<Int32>

The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".

ocpdate
Nullable<DateTimeOffset>

The time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly.

maxresults
Nullable<Int32>

The maximum number of items to return in the response. A maximum of 1000 applications can be returned.

filter
String

An OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-task-files.

recursive
Nullable<Boolean>

Whether to list children of the Task directory. This parameter can be used in combination with the filter parameter to list specific type of files.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The AsyncPageable<T> from the service containing a list of BinaryData objects. Details of the body schema for each item in the collection are in the Remarks section below.

Exceptions

jobId or taskId is null.

jobId or taskId is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Examples

This sample shows how to call GetTaskFilesAsync and parse the result.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);

await foreach (BinaryData item in client.GetTaskFilesAsync("<jobId>", "<taskId>", null, null, null, null, null, null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.ToString());
}

This sample shows how to call GetTaskFilesAsync with all parameters and parse the result.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);

await foreach (BinaryData item in client.GetTaskFilesAsync("<jobId>", "<taskId>", 1234, DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"), 1234, "<filter>", true, null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("name").ToString());
    Console.WriteLine(result.GetProperty("url").ToString());
    Console.WriteLine(result.GetProperty("isDirectory").ToString());
    Console.WriteLine(result.GetProperty("properties").GetProperty("creationTime").ToString());
    Console.WriteLine(result.GetProperty("properties").GetProperty("lastModified").ToString());
    Console.WriteLine(result.GetProperty("properties").GetProperty("contentLength").ToString());
    Console.WriteLine(result.GetProperty("properties").GetProperty("contentType").ToString());
    Console.WriteLine(result.GetProperty("properties").GetProperty("fileMode").ToString());
}

Applies to

GetTaskFilesAsync(String, String, Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, String, Nullable<Boolean>, CancellationToken)

Source:
BatchClient.cs

Lists the files in a Task's directory on its Compute Node.

public virtual Azure.AsyncPageable<Azure.Compute.Batch.BatchNodeFile> GetTaskFilesAsync (string jobId, string taskId, int? timeOutInSeconds = default, DateTimeOffset? ocpdate = default, int? maxresults = default, string filter = default, bool? recursive = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetTaskFilesAsync : string * string * Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * string * Nullable<bool> * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.Compute.Batch.BatchNodeFile>
override this.GetTaskFilesAsync : string * string * Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * string * Nullable<bool> * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.Compute.Batch.BatchNodeFile>
Public Overridable Function GetTaskFilesAsync (jobId As String, taskId As String, Optional timeOutInSeconds As Nullable(Of Integer) = Nothing, Optional ocpdate As Nullable(Of DateTimeOffset) = Nothing, Optional maxresults As Nullable(Of Integer) = Nothing, Optional filter As String = Nothing, Optional recursive As Nullable(Of Boolean) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As AsyncPageable(Of BatchNodeFile)

Parameters

jobId
String

The ID of the Job that contains the Task.

taskId
String

The ID of the Task whose files you want to list.

timeOutInSeconds
Nullable<Int32>

The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".

ocpdate
Nullable<DateTimeOffset>

The time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly.

maxresults
Nullable<Int32>

The maximum number of items to return in the response. A maximum of 1000 applications can be returned.

filter
String

An OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-task-files.

recursive
Nullable<Boolean>

Whether to list children of the Task directory. This parameter can be used in combination with the filter parameter to list specific type of files.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

jobId or taskId is null.

jobId or taskId is an empty string, and was expected to be non-empty.

Examples

This sample shows how to call GetTaskFilesAsync.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);

await foreach (BatchNodeFile item in client.GetTaskFilesAsync("<jobId>", "<taskId>"))
{
}

This sample shows how to call GetTaskFilesAsync with all parameters.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);

await foreach (BatchNodeFile item in client.GetTaskFilesAsync("<jobId>", "<taskId>", timeOutInSeconds: 1234, ocpdate: DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"), maxresults: 1234, filter: "<filter>", recursive: true))
{
}

Applies to