azure-sdk-for-net icon indicating copy to clipboard operation
azure-sdk-for-net copied to clipboard

AnalyzeDocumentFromUriAsync Does not exist

Open dwainbrowne opened this issue 2 months ago • 4 comments

Type of issue

Code doesn't work

Description

I'm very confused on which API I should be using using Azure.AI.DocumentIntelligence; using Azure.AI.FormRecognizer;

I tried the code sample provided, and it has no method called AnalyzeDocumentFromUriAsync

'DocumentIntelligenceClient' does not contain a definition for 'AnalyzeDocumentFromUriAsync' and no accessible extension method 'AnalyzeDocumentFromUriAsync' accepting a first argument of type 'DocumentIntelligenceClient' could be found (are you missing a using directive or an assembly reference?)CS1061

Sample code:

var client = new DocumentIntelligenceClient(new Uri(endpoint), new AzureKeyCredential(apiKey));

        Console.WriteLine("Analyzing document from URL...");
        AnalyzeDocumentOperation operation = await client.AnalyzeDocumentFromUriAsync(WaitUntil.Completed, "prebuilt-layout", fileUri);
        AnalyzeResult result = operation.Value;

        foreach (DocumentPage page in result.Pages)
        {
            Console.WriteLine($"Document Page {page.PageNumber} has {page.Lines.Count} line(s), {page.Words.Count} word(s),");
            Console.WriteLine($"and {page.SelectionMarks.Count} selection mark(s).");

            for (int i = 0; i < page.Lines.Count; i++)
            {
                DocumentLine line = page.Lines[i];
                Console.WriteLine($"  Line {i} has content: '{line.Content}'.");

                Console.WriteLine($"    Its bounding polygon (points ordered clockwise):");

                for (int j = 0; j < line.BoundingPolygon.Count; j++)
                {
                    Console.WriteLine($"      Point {j} => X: {line.BoundingPolygon[j].X}, Y: {line.BoundingPolygon[j].Y}");
                }
            }

Page URL

https://learn.microsoft.com/en-us/dotnet/api/overview/azure/ai.formrecognizer-readme?view=azure-dotnet

Content source URL

https://github.com/Azure/azure-docs-sdk-dotnet/blob/master/api/overview/azure/latest/ai.formrecognizer-readme.md

Document Version Independent Id

ed88679a-395f-a658-010c-4fdeea56eade

Article author

@azure-sdk

Metadata

  • ID: 503d323c-17e3-43dc-2b67-2b8595e5ac84
  • Service: formrecognizer

dwainbrowne avatar Jun 26 '24 13:06 dwainbrowne