DocumentIntelligenceAdministrationClient.GetOperation 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
GetOperation(String, RequestContext) |
[Protocol Method] Gets operation info.
|
GetOperation(String, CancellationToken) |
Gets operation info. |
GetOperation(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 GetOperation(String, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.Response GetOperation (string operationId, Azure.RequestContext context);
abstract member GetOperation : string * Azure.RequestContext -> Azure.Response
override this.GetOperation : string * Azure.RequestContext -> Azure.Response
Public Overridable Function GetOperation (operationId As String, context As RequestContext) As 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 GetOperation 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 = client.GetOperation("<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 GetOperation 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 = client.GetOperation("<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
GetOperation(String, CancellationToken)
Gets operation info.
public virtual Azure.Response<Azure.AI.DocumentIntelligence.OperationDetails> GetOperation (string operationId, System.Threading.CancellationToken cancellationToken = default);
abstract member GetOperation : string * System.Threading.CancellationToken -> Azure.Response<Azure.AI.DocumentIntelligence.OperationDetails>
override this.GetOperation : string * System.Threading.CancellationToken -> Azure.Response<Azure.AI.DocumentIntelligence.OperationDetails>
Public Overridable Function GetOperation (operationId As String, Optional cancellationToken As CancellationToken = Nothing) As 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 GetOperation.
Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
DocumentIntelligenceAdministrationClient client = new DocumentIntelligenceAdministrationClient(endpoint, credential);
Response<OperationDetails> response = client.GetOperation("<operationId>");
This sample shows how to call GetOperation 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 = client.GetOperation("<operationId>");
Applies to
Azure SDK for .NET