Skip to main content
Post

#PowerPlatformTip 143: Reduce AI Costs with Thumbnail-First Document Processing

#PowerPlatformTip 143: Reduce AI Costs with Thumbnail-First Document Processing

TL;DR: SharePoint renders a thumbnail image of page 1 for every PDF. Send that image to your AI model first, check the required fields, and process the full PDF only as a fallback. You pay for one image instead of every page whenever page 1 holds the data.

💡 Challenge

AI document processing is billed per page or per call. Since 1 November 2025, AI Builder features in Power Apps and Power Automate consume Copilot Credits once AI Builder credits are exhausted (if neither is available, the run is blocked), and since 1 November 2026 new or renewed Power Platform licenses no longer come with seeded AI Builder credits; licenses bought or renewed before keep them until the end of their contract term (AI Builder licensing). Many business documents like invoices run to several pages, but the critical information often sits on the first page only. Processing entire PDFs with Azure AI Document Intelligence, the OpenAI Vision API, or AI Builder spends AI capacity on terms, legal disclaimers, and appendices that hold no extractable business data. Check the current price list of your provider before you calculate savings.

✅ Solution

Implement a thumbnail-first strategy in Power Automate. Whether documents arrive via Power Apps upload or email attachment, save them to SharePoint first, use Get File Properties to access the thumbnail, send it to your AI provider for extraction, validate the results, and only process the full document if required fields are missing or confidence is too low. This approach works with an AI service that accepts image input, returns the required fields in a form you can check (ideally with confidence scores), and can also process the full PDF for the fallback. Check these three points separately for your provider: image format, PDF processing and response schema. The fallback logic sends every case it detects as insufficient (missing fields, low confidence, a failed step) to the full document. It cannot catch a wrong value that comes back with high confidence, so see the Page 1 note below.

flowchart TD
    A["Document saved to SharePoint"] --> B["Get file properties<br/>read thumbnail URL"]
    B --> C["Send thumbnail to AI provider"]
    C --> D{"Required fields present<br/>and confidence high enough?"}
    D -->|Yes| E["Done - full document not processed"]
    D -->|No| F["Fallback: process the full PDF<br/>with the same provider"]
    F --> G["Use full-document result"]

🔧 How It’s Done

1. Configure document intake and save to SharePoint

🔸 Power Apps: user uploads a document → Create file to save it in a SharePoint library.

🔸 Email: when a new email arrives (with attachments) → Apply to each attachment → Get attachment content → Create file in SharePoint.

🔸 Both paths must save the document to SharePoint first, before accessing thumbnails.

2. Get file properties to access thumbnail metadata

🔸 Add “Get file properties” immediately after file creation.

🔸 Id is the list item ID from the previous action: outputs('Create_file')?['body/ItemId'].

🔸 This exposes all file metadata, including thumbnail URLs.

🔸 The thumbnail is only available after the file is saved to SharePoint, not during upload.

3. Extract the thumbnail URL

🔸 Use the expression @{outputs('Get_file_properties')?['body/{Thumbnail}/Large']}.

🔸 Available sizes: Small, Medium, Large (Large gives the best quality for AI).

🔸 No Parse JSON needed, direct access to the thumbnail URL.

4. Convert the thumbnail and send it to your AI provider

🔸 Download the thumbnail from the URL, for example with an HTTP action that authenticates against SharePoint (HTTP with Microsoft Entra ID).

🔸 Note: HTTP is a premium connector (Cloud flow error code reference lists it among the premium connectors), so the flow needs a Power Automate Premium licence for its users or a Process licence assigned to the flow (licensing FAQ). Depending on your tenant, the thumbnail URL may only be reachable with authentication; test the link with an unimportant test file before you build on it.

🔸 Send the image to the model of your choice: AI Builder Extract information from invoices accepts JPG and PNG as well as PDF, and Azure AI Document Intelligence or a vision-capable model accept images too.

🔸 Data protection: the thumbnail and, in the fallback, the full PDF both leave SharePoint for the provider you choose. Use only providers and endpoints that are approved for your documents, and restrict who can see the run history (turn on Secure inputs and Secure outputs on the actions that carry document content).

5. Validate completeness and confidence

🔸 Check that all required fields are populated (invoice number, date, total, vendor).

🔸 Compare confidence scores against a threshold you define.

🔸 If validation passes → stop here and skip the full-document processing.

6. Add a conditional fallback

🔸 Condition: IF required fields missing OR confidence below your threshold → process the full PDF with the same provider (Get file content on the original).

🔸 ELSE proceed with the thumbnail-extracted data.

🔸 Errors need a path too: if the thumbnail URL is empty, the download fails or the extraction action fails, send the document to the PDF path as well. Put the download and the extraction in one Scope: if the download fails, the extraction is skipped rather than failed, so a run-after on the extraction alone would miss it. Use Configure run after (failed, skipped, timed out) on the step after the Scope to start the PDF path, and check the extracted fields only when the Scope succeeded. If the PDF path fails too, mark the document as unprocessed (for example with a status column in SharePoint) and notify someone, so no document passes silently.

🔸 Log the success/fallback ratio for ongoing optimization.

7. Monitor savings and success rates

🔸 Track the thumbnail-only success rate for your document types.

🔸 Compare monthly cost: thumbnail-first vs. full processing.

🔸 Estimate the saving with the current prices of your provider and your own page counts.

🎉 Result

Only documents where the thumbnail is not enough are processed in full, so you usually pay for fewer pages (documents that fall back cost the thumbnail attempt plus the full run), and the fallback makes sure no document is skipped. The approach is not tied to one AI provider.

🌟 Key Advantages

🔸 Universal intake: works with Power Apps uploads, email attachments, or any source, just save to SharePoint first.

🔸 Cost optimization: for multi-page originals, fewer pages are processed whenever the thumbnail is enough (for a one-page original the thumbnail replaces one page with one image, so there is no page saving), whichever provider you use (Azure AI, OpenAI, Google Document AI, AI Builder). A document that falls back is processed twice, and some providers bill per call rather than per page, so compare thumbnail cost plus fallback cost with direct processing for your own document mix.

🔸 Fallback: full documents are processed only when thumbnail extraction is insufficient.

🔸 Simple syntax: direct thumbnail access via @{outputs('Get_file_properties')?['body/{Thumbnail}/Large']}, no complex JSON parsing.

🔸 Platform agnostic: works with AI services that accept image input and return checkable fields (see the three points in the Solution), protecting against vendor lock-in.

🔸 Performance: smaller payloads usually mean shorter processing time.

🔸 Licensing: the SharePoint actions are standard. The HTTP calls need a Premium licence (or a Process licence assigned to the flow), as do some AI provider connectors.

⚠️ Good to Know

🔸 Page 1 only. The SharePoint thumbnail shows the first page of the document, at a reduced resolution. The pattern pays off for documents whose key fields sit on page 1 (invoice number, date, vendor). If the total is only on the last page of a multi-page invoice, the field is usually missing, the validation in step 5 fails and the fallback processes the full PDF. Step 5 checks that fields are filled and confident, not that the value is the right one: a subtotal printed on page 1 can come back as the total with high confidence and pass. Use the thumbnail path only for document types whose final amount is on page 1, or add a plausibility check; otherwise process the original.

🔸 Small fonts. Fine print can be unreadable in the thumbnail. Use Large, and let the confidence check send unclear cases to the fallback.

🔸 Measure before you promise. How much you save depends on your page counts and the share of documents that pass on the thumbnail. Log both (step 7) and calculate with the current rates of your provider.

🛠️ FAQ

1. Why must I save to SharePoint first instead of processing uploads directly?

SharePoint generates thumbnails automatically when files are saved to document libraries. The thumbnail isn’t available during upload, only after SharePoint processes and stores the file. That’s why Get File Properties must run after Create File, not during the upload trigger. Power Apps uploads and email attachments both need this two-step process: save first, then access thumbnail metadata.

2. What’s the difference between Small, Medium, and Large thumbnail sizes for AI processing?

SharePoint exposes three thumbnail sizes: Small, Medium, and Large. Large gives the most detail for documents with small fonts but uses more bandwidth. Use @{outputs('Get_file_properties')?['body/{Thumbnail}/Medium']} for cost-optimized processing or Large for maximum accuracy.

3. How do I handle different document sources (Power Apps, email, manual upload) in one flow?

Create a child flow that handles the thumbnail-processing logic, then call it from multiple parent flows. Each parent handles its specific trigger (Power Apps button, email arrival, manual trigger), saves the document to SharePoint, and calls the child flow with the file ID. This modular approach keeps intake methods consistent while maintaining separation of concerns.

This tip is by Marcel Lehmann, Microsoft MVP (Business Applications) and founder of the Power Platform Academy, which runs free live workshops (in German). See the next free workshop dates (in German). For companies that want this implemented for them, see KMUpower: Power Platform consulting & automation for SMEs (DACH).

This post is licensed under CC BY 4.0 by the author.

Microsoft and the Power Platform product names (for example Power Apps, Power Automate, Copilot Studio) are trademarks of the Microsoft group of companies. This is an independent website. It is not operated, sponsored or endorsed by Microsoft.