@@ -644,15 +644,9 @@ AzureKeyCredential credential = new AzureKeyCredential(key);
644644DocumentIntelligenceClient client = new DocumentIntelligenceClient (new Uri (endpoint ), credential );
645645
646646// sample invoice document
647+ Uri uriSource = new Uri (" https://raw.githubusercontent.com/Azure-Samples/cognitive-services-REST-api-samples/master/curl/form-recognizer/sample-invoice.pdf" );
647648
648- Uri invoiceUri = new Uri (" https://raw.githubusercontent.com/Azure-Samples/cognitive-services-REST-api-samples/master/curl/form-recognizer/sample-invoice.pdf" );
649-
650- AnalyzeDocumentContent content = new AnalyzeDocumentContent ()
651- {
652- UrlSource = invoiceUri
653- };
654-
655- Operation < AnalyzeResult > operation = await client .AnalyzeDocumentAsync (WaitUntil .Completed , " prebuilt-invoice" , content );
649+ Operation < AnalyzeResult > operation = await client .AnalyzeDocumentAsync (WaitUntil .Completed , " prebuilt-invoice" , uriSource );
656650
657651AnalyzeResult result = operation .Value ;
658652
@@ -663,39 +657,39 @@ for (int i = 0; i < result.Documents.Count; i++)
663657 AnalyzedDocument document = result .Documents [i ];
664658
665659 if (document .Fields .TryGetValue (" VendorName" , out DocumentField vendorNameField )
666- && vendorNameField .Type == DocumentFieldType .String )
660+ && vendorNameField .FieldType == DocumentFieldType .String )
667661 {
668662 string vendorName = vendorNameField .ValueString ;
669663 Console .WriteLine ($" Vendor Name: '{vendorName }', with confidence {vendorNameField .Confidence }" );
670664 }
671665
672666 if (document .Fields .TryGetValue (" CustomerName" , out DocumentField customerNameField )
673- && customerNameField .Type == DocumentFieldType .String )
667+ && customerNameField .FieldType == DocumentFieldType .String )
674668 {
675669 string customerName = customerNameField .ValueString ;
676670 Console .WriteLine ($" Customer Name: '{customerName }', with confidence {customerNameField .Confidence }" );
677671 }
678672
679673 if (document .Fields .TryGetValue (" Items" , out DocumentField itemsField )
680- && itemsField .Type == DocumentFieldType .List )
674+ && itemsField .FieldType == DocumentFieldType .List )
681675 {
682676 foreach (DocumentField itemField in itemsField .ValueList )
683677 {
684678 Console .WriteLine (" Item:" );
685679
686- if (itemField .Type == DocumentFieldType .Dictionary )
680+ if (itemField .FieldType == DocumentFieldType .Dictionary )
687681 {
688682 IReadOnlyDictionary < string , DocumentField > itemFields = itemField .ValueDictionary ;
689683
690684 if (itemFields .TryGetValue (" Description" , out DocumentField itemDescriptionField )
691- && itemDescriptionField .Type == DocumentFieldType .String )
685+ && itemDescriptionField .FieldType == DocumentFieldType .String )
692686 {
693687 string itemDescription = itemDescriptionField .ValueString ;
694688 Console .WriteLine ($" Description: '{itemDescription }', with confidence {itemDescriptionField .Confidence }" );
695689 }
696690
697691 if (itemFields .TryGetValue (" Amount" , out DocumentField itemAmountField )
698- && itemAmountField .Type == DocumentFieldType .Currency )
692+ && itemAmountField .FieldType == DocumentFieldType .Currency )
699693 {
700694 CurrencyValue itemAmount = itemAmountField .ValueCurrency ;
701695 Console .WriteLine ($" Amount: '{itemAmount .CurrencySymbol }{itemAmount .Amount }', with confidence {itemAmountField .Confidence }" );
@@ -705,27 +699,26 @@ for (int i = 0; i < result.Documents.Count; i++)
705699 }
706700
707701 if (document .Fields .TryGetValue (" SubTotal" , out DocumentField subTotalField )
708- && subTotalField .Type == DocumentFieldType .Currency )
702+ && subTotalField .FieldType == DocumentFieldType .Currency )
709703 {
710704 CurrencyValue subTotal = subTotalField .ValueCurrency ;
711705 Console .WriteLine ($" Sub Total: '{subTotal .CurrencySymbol }{subTotal .Amount }', with confidence {subTotalField .Confidence }" );
712706 }
713707
714708 if (document .Fields .TryGetValue (" TotalTax" , out DocumentField totalTaxField )
715- && totalTaxField .Type == DocumentFieldType .Currency )
709+ && totalTaxField .FieldType == DocumentFieldType .Currency )
716710 {
717711 CurrencyValue totalTax = totalTaxField .ValueCurrency ;
718712 Console .WriteLine ($" Total Tax: '{totalTax .CurrencySymbol }{totalTax .Amount }', with confidence {totalTaxField .Confidence }" );
719713 }
720714
721715 if (document .Fields .TryGetValue (" InvoiceTotal" , out DocumentField invoiceTotalField )
722- && invoiceTotalField .Type == DocumentFieldType .Currency )
716+ && invoiceTotalField .FieldType == DocumentFieldType .Currency )
723717 {
724718 CurrencyValue invoiceTotal = invoiceTotalField .ValueCurrency ;
725719 Console .WriteLine ($" Invoice Total: '{invoiceTotal .CurrencySymbol }{invoiceTotal .Amount }', with confidence {invoiceTotalField .Confidence }" );
726720 }
727721}
728-
729722```
730723
731724** Run your application**
0 commit comments