你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
BatchClient.GetTaskFileAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
GetTaskFileAsync(String, String, String, Nullable<Int32>, Nullable<DateTimeOffset>, String, RequestConditions, CancellationToken) |
Returns the content of the specified Task file. |
GetTaskFileAsync(String, String, String, Nullable<Int32>, Nullable<DateTimeOffset>, String, RequestConditions, RequestContext) |
[Protocol Method] Returns the content of the specified Task file.
|
GetTaskFileAsync(String, String, String, Nullable<Int32>, Nullable<DateTimeOffset>, String, RequestConditions, CancellationToken)
- Source:
- BatchClientCustom.cs
Returns the content of the specified Task file.
public virtual System.Threading.Tasks.Task<Azure.Response<BinaryData>> GetTaskFileAsync (string jobId, string taskId, string filePath, int? timeOutInSeconds = default, DateTimeOffset? ocpdate = default, string ocpRange = default, Azure.RequestConditions requestConditions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetTaskFileAsync : string * string * string * Nullable<int> * Nullable<DateTimeOffset> * string * Azure.RequestConditions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<BinaryData>>
override this.GetTaskFileAsync : string * string * string * Nullable<int> * Nullable<DateTimeOffset> * string * Azure.RequestConditions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<BinaryData>>
Public Overridable Function GetTaskFileAsync (jobId As String, taskId As String, filePath As String, Optional timeOutInSeconds As Nullable(Of Integer) = Nothing, Optional ocpdate As Nullable(Of DateTimeOffset) = Nothing, Optional ocpRange As String = Nothing, Optional requestConditions As RequestConditions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of BinaryData))
Parameters
- jobId
- String
The ID of the Job that contains the Task.
- taskId
- String
The ID of the Task whose file you want to retrieve.
- filePath
- String
The path to the Task file that you want to get the content of.
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.
- ocpRange
- String
The byte range to be retrieved. The default is to retrieve the entire file. The format is bytes=startRange-endRange.
- requestConditions
- RequestConditions
The content to send as the request conditions of the request.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
jobId
, taskId
or filePath
is null.
jobId
, taskId
or filePath
is an empty string, and was expected to be non-empty.
Examples
This sample shows how to call GetTaskFileAsync.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
Response<BinaryData> response = await client.GetTaskFileAsync("<jobId>", "<taskId>", "<filePath>");
This sample shows how to call GetTaskFileAsync with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
Response<BinaryData> response = await client.GetTaskFileAsync("<jobId>", "<taskId>", "<filePath>", timeOutInSeconds: 1234, ocpdate: DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"), ocpRange: "<ocp-range>", requestConditions: null);
Applies to
GetTaskFileAsync(String, String, String, Nullable<Int32>, Nullable<DateTimeOffset>, String, RequestConditions, RequestContext)
- Source:
- BatchClientCustom.cs
[Protocol Method] Returns the content of the specified Task file.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler GetTaskFileAsync(String, String, String, Nullable<Int32>, Nullable<DateTimeOffset>, String, RequestConditions, CancellationToken) convenience overload with strongly typed models first.
public virtual System.Threading.Tasks.Task<Azure.Response> GetTaskFileAsync (string jobId, string taskId, string filePath, int? timeOutInSeconds, DateTimeOffset? ocpdate, string ocpRange, Azure.RequestConditions requestConditions, Azure.RequestContext context);
abstract member GetTaskFileAsync : string * string * string * Nullable<int> * Nullable<DateTimeOffset> * string * Azure.RequestConditions * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetTaskFileAsync : string * string * string * Nullable<int> * Nullable<DateTimeOffset> * string * Azure.RequestConditions * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetTaskFileAsync (jobId As String, taskId As String, filePath As String, timeOutInSeconds As Nullable(Of Integer), ocpdate As Nullable(Of DateTimeOffset), ocpRange As String, requestConditions As RequestConditions, context As RequestContext) As Task(Of Response)
Parameters
- jobId
- String
The ID of the Job that contains the Task.
- taskId
- String
The ID of the Task whose file you want to retrieve.
- filePath
- String
The path to the Task file that you want to get the content of.
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.
- ocpRange
- String
The byte range to be retrieved. The default is to retrieve the entire file. The format is bytes=startRange-endRange.
- requestConditions
- RequestConditions
The content to send as the request conditions of the request.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The response returned from the service.
Exceptions
jobId
, taskId
or filePath
is null.
jobId
, taskId
or filePath
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 GetTaskFileAsync and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
Response response = await client.GetTaskFileAsync("<jobId>", "<taskId>", "<filePath>", null, null, null, null, null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());
This sample shows how to call GetTaskFileAsync 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);
Response response = await client.GetTaskFileAsync("<jobId>", "<taskId>", "<filePath>", 1234, DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"), "<ocp-range>", null, null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());