Skip to content

Instantly share code, notes, and snippets.



Created Mar 19, 2021
What would you like to do?
Retrieve fields from ID with Form Recognizer
static async Task Main(string[] args)
var resultUrl = await StartAnalyzingImage(); // defined here
IdentificationResult result;
await Task.Delay(1000); // wait 1 second before checking, otherwise the API will return 429
var json = await _client.GetStringAsync(resultUrl);
result = JsonConvert.DeserializeObject<IdentificationResult>(json);
} while (result?.Status != "succeeded");
var documentResults = result.AnalyzeResult.DocumentResults;
if (documentResults != null && documentResults.Length != 0)
foreach (var documentResult in documentResults)
Console.WriteLine($"First name: {documentResult.Fields.FirstName}, confidence: {documentResult.Fields.FirstName.Confidence}");
Console.WriteLine($"Last name: {documentResult.Fields.FirstName}, confidence: {documentResult.Fields.LastName.Confidence}");
Console.WriteLine($"Address: {documentResult.Fields.Address}, confidence: {documentResult.Fields.Address.Confidence}");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment