Share via


DocumentIntelligenceAdministrationClient.GetOperationsAsync Method

Definition

Overloads

GetOperationsAsync(RequestContext)

[Protocol Method] Lists all operations.

GetOperationsAsync(CancellationToken)

Lists all operations.

GetOperationsAsync(RequestContext)

Source:
DocumentIntelligenceAdministrationClient.cs

[Protocol Method] Lists all operations.

public virtual Azure.AsyncPageable<BinaryData> GetOperationsAsync (Azure.RequestContext context);
abstract member GetOperationsAsync : Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
override this.GetOperationsAsync : Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
Public Overridable Function GetOperationsAsync (context As RequestContext) As AsyncPageable(Of BinaryData)

Parameters

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

Service returned a non-success status code.

Examples

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

Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
DocumentIntelligenceAdministrationClient client = new DocumentIntelligenceAdministrationClient(endpoint, credential);

await foreach (BinaryData item in client.GetOperationsAsync(null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).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 GetOperationsAsync 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);

await foreach (BinaryData item in client.GetOperationsAsync(null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).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

GetOperationsAsync(CancellationToken)

Source:
DocumentIntelligenceAdministrationClient.cs

Lists all operations.

public virtual Azure.AsyncPageable<Azure.AI.DocumentIntelligence.OperationDetails> GetOperationsAsync (System.Threading.CancellationToken cancellationToken = default);
abstract member GetOperationsAsync : System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.AI.DocumentIntelligence.OperationDetails>
override this.GetOperationsAsync : System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.AI.DocumentIntelligence.OperationDetails>
Public Overridable Function GetOperationsAsync (Optional cancellationToken As CancellationToken = Nothing) As AsyncPageable(Of OperationDetails)

Parameters

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Examples

This sample shows how to call GetOperationsAsync.

Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
DocumentIntelligenceAdministrationClient client = new DocumentIntelligenceAdministrationClient(endpoint, credential);

await foreach (OperationDetails item in client.GetOperationsAsync())
{
}

This sample shows how to call GetOperationsAsync with all parameters.

Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
DocumentIntelligenceAdministrationClient client = new DocumentIntelligenceAdministrationClient(endpoint, credential);

await foreach (OperationDetails item in client.GetOperationsAsync())
{
}

Applies to