你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

BatchClient.GetTaskFiles Method

Definition

Overloads

GetTaskFiles(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.

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

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

GetTaskFiles(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.Pageable<BinaryData> GetTaskFiles (string jobId, string taskId, int? timeOutInSeconds, DateTimeOffset? ocpdate, int? maxresults, string filter, bool? recursive, Azure.RequestContext context);
abstract member GetTaskFiles : string * string * Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * string * Nullable<bool> * Azure.RequestContext -> Azure.Pageable<BinaryData>
override this.GetTaskFiles : string * string * Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * string * Nullable<bool> * Azure.RequestContext -> Azure.Pageable<BinaryData>
Public Overridable Function GetTaskFiles (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 Pageable(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 Pageable<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 GetTaskFiles and parse the result.

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

foreach (BinaryData item in client.GetTaskFiles("<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 GetTaskFiles 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);

foreach (BinaryData item in client.GetTaskFiles("<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

GetTaskFiles(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.Pageable<Azure.Compute.Batch.BatchNodeFile> GetTaskFiles (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 GetTaskFiles : string * string * Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * string * Nullable<bool> * System.Threading.CancellationToken -> Azure.Pageable<Azure.Compute.Batch.BatchNodeFile>
override this.GetTaskFiles : string * string * Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * string * Nullable<bool> * System.Threading.CancellationToken -> Azure.Pageable<Azure.Compute.Batch.BatchNodeFile>
Public Overridable Function GetTaskFiles (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 Pageable(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 GetTaskFiles.

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

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

This sample shows how to call GetTaskFiles with all parameters.

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

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

Applies to