DocumentIntelligenceAdministrationClient.GetOperationAsync 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
GetOperationAsync(String, RequestContext) |
[Protocol Method] Gets operation info.
|
GetOperationAsync(String, CancellationToken) |
Gets operation info. |
GetOperationAsync(String, RequestContext)
[Protocol Method] Gets operation info.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler GetOperationAsync(String, CancellationToken) convenience overload with strongly typed models first.
public virtual System.Threading.Tasks.Task<Azure.Response> GetOperationAsync (string operationId, Azure.RequestContext context);
abstract member GetOperationAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetOperationAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetOperationAsync (operationId As String, context As RequestContext) As Task(Of Response)
Parameters
- operationId
- String
Operation ID.
- 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
operationId
is null.
operationId
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 GetOperationAsync and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
DocumentIntelligenceAdministrationClient client = new DocumentIntelligenceAdministrationClient(endpoint, credential);
Response response = await client.GetOperationAsync("<operationId>", null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("operationId").ToString());
Console.WriteLine(result.GetProperty("status").ToString());
Console.WriteLine(result.GetProperty("createdDateTime").ToString());
Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString());
Console.WriteLine(result.GetProperty("kind").ToString());
Console.WriteLine(result.GetProperty("resourceLocation").ToString());
This sample shows how to call GetOperationAsync with all parameters and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
DocumentIntelligenceAdministrationClient client = new DocumentIntelligenceAdministrationClient(endpoint, credential);
Response response = await client.GetOperationAsync("<operationId>", null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("operationId").ToString());
Console.WriteLine(result.GetProperty("status").ToString());
Console.WriteLine(result.GetProperty("percentCompleted").ToString());
Console.WriteLine(result.GetProperty("createdDateTime").ToString());
Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString());
Console.WriteLine(result.GetProperty("kind").ToString());
Console.WriteLine(result.GetProperty("resourceLocation").ToString());
Console.WriteLine(result.GetProperty("apiVersion").ToString());
Console.WriteLine(result.GetProperty("tags").GetProperty("<key>").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("message").ToString());
Applies to
GetOperationAsync(String, CancellationToken)
Gets operation info.
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.AI.DocumentIntelligence.OperationDetails>> GetOperationAsync (string operationId, System.Threading.CancellationToken cancellationToken = default);
abstract member GetOperationAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.DocumentIntelligence.OperationDetails>>
override this.GetOperationAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.DocumentIntelligence.OperationDetails>>
Public Overridable Function GetOperationAsync (operationId As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of OperationDetails))
Parameters
- operationId
- String
Operation ID.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
operationId
is null.
operationId
is an empty string, and was expected to be non-empty.
Examples
This sample shows how to call GetOperationAsync.
Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
DocumentIntelligenceAdministrationClient client = new DocumentIntelligenceAdministrationClient(endpoint, credential);
Response<OperationDetails> response = await client.GetOperationAsync("<operationId>");
This sample shows how to call GetOperationAsync with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
DocumentIntelligenceAdministrationClient client = new DocumentIntelligenceAdministrationClient(endpoint, credential);
Response<OperationDetails> response = await client.GetOperationAsync("<operationId>");
Applies to
Azure SDK for .NET