Building and customizing solutions using Microsoft 365 Copilot APIs and tools
This looks less like a “time entities” issue and more like an unreliable end-to-end design: the agent is being asked to extract multiple files, apply calculations, reproduce an exact template, generate an .eml, and preserve binary attachments in one generative step.
Recommended approach
Separate knowledge from runtime files
Keep calculation rules and the body template in the agent’s instructions or persistent knowledge.
Upload each client’s Excel/PDF files in the same message that starts processing. Runtime attachments are separate from knowledge sources and may be skipped if processing fails.
Do not rely on ordinary knowledge retrieval for an exact email body
Store the body as a deterministic template, with placeholders such as {{ClientName}}, {{Amount}}, and {{Date}}.
Tell the agent to return structured fields only, preferably JSON.
Have a flow insert those values into the template. Retrieval and generative rewriting can omit or shorten rows, so it should not be the final formatting mechanism.
Use a flow for the file and email operations
Agent: identify the client, extract values, calculate results, and return JSON.
Flow: fetch the original files by SharePoint/OneDrive file identifier, construct the exact body, create the Outlook draft, and add attachments using file name plus file content.
Avoid asking the model to carry binary file content through its conversational output. A filename or extracted text is not the binary content required by an attachment action.
Add validation before draft creation Require the workflow to stop rather than create a partial draft when:
an expected file is missing;
required Excel/PDF values are null;
the calculated results fail checks;
the generated body is missing required sections or rows;
the flow cannot retrieve an attachment’s binary content.
Reduce file complexity during testing Test with one client and one document at a time, then gradually add files. Microsoft recommends splitting large or complex PDFs and spreadsheets into smaller inputs when upload or interpretation is unreliable.