Automating Local Document Retrieval and Email Drafting with Attachment by Using Copilot Studio

By | June 11, 2025

Automating Local Document Retrieval and Email Drafting with Attachment by Using Copilot Studio

In the age of information, effectively searching, aggregating, and sharing pertinent information is vital in terms of productivity. This blog describes an end-to-end solution developed with Microsoft Copilot Studio for automating information extraction from local document stores. Furthermore, it details the seamless drafting of emails, providing a holistic approach to information management and communication.

Imagine yourself being a Company with various documents and files in a single, shared local repository. Retrieving specific information out of a company’s huge local document repository often seems like hunting for a needle in a haystack.

For example, consider a typical situation: your supervisor needs the scope of a specific project immediately, yet that vital information lies deeply embedded within a proposal document saved on a shared local server. The conventional method of wading through dozens of folders, opening numerous files, and thoroughly searching for the appropriate data can eat up precious time and seriously impede productivity.

In this blog, we’ll demonstrate how you can extend the Copilot capabilities to access and retrieve information from files stored in locally shared folders, fully automating this process for greater efficiency.

This solution utilizes several major technologies to implement its functionality:

  • Microsoft Copilot Studio: The central platform for developing smart conversational AI bots, allowing user engagement and coordinating intricate workflows.
  • On-Premise Data Gateway: A secure connection that allows access to data that is stored within the local network from cloud-based services such as Power Automate. This is crucial when trying to integrate with your local document storage.
  • Microsoft Power Automate (Flows): A subset of the Microsoft Power Platform, utilized for task automation and integration between different services, such as document creation and email composition.

Let’s consider a common organization where project-related documents are kept. We have arranged these documents in folders according to varying parameters. Our system intelligently picks the concerned folder, depending on your search query, to effectively get the file data you require.

Email Drafting with Attachment by Using Copilot Studio

These documents, usually in the form of a PDF file, are kept in a specific folder on your local server.

Email Drafting with Attachment by Using Copilot Studio

Suppose you ask our Copilot: “What is the scope of XYZ-IPD-01?”

Within seconds, the Copilot gives an accurate response, and the project scope appears right in the chat window. No searching through folders, no opening multiple documents – just the answer you require, right away.

Email Drafting with Attachment by Using Copilot Studio

Let’s now explore how this is put into action. Within Microsoft Copilot Studio, dedicated topics are configured specifically to handle local document search requests.

Email Drafting with Attachment by Using Copilot Studio

It initiates a Power Automate flow to locate and retrieve the targeted document from your local system.

Email Drafting with Attachment by Using Copilot Studio

This flow utilizes actions like ‘List Files’ as shown in the images, for which we have renamed with ‘List Files in Local Folder’ to locate the file, and ‘Get File Content’ for which we have renamed with ‘Get File Content from the Local File’ to fetch its complete content.

Email Drafting with Attachment by Using Copilot Studio

Each time a user initiates a search, Copilot Studio sends the query to on-premises PDF files through a Power Automate Flow, utilizing the gateway for communication. The Power Automate flow is used to search for the equivalent job or project file by invoking the File System Connector. The connector utilizes the On-Premise Data Gateway.

On-Premise Data Gateway authentically leverages the given system login credentials to access your local file system. Most importantly, this portal establishes a secure link to the specific local server folder containing your project documents, allowing Power Automate to retrieve them using the ‘List File’ and ‘Get File Content’ actions.

Email Drafting with Attachment by Using Copilot Studio

Through this gateway, the Power Automate flow, configured with the local system folder path (where all files are stored), successfully retrieves the entire file information.

The extracted information from the local documents, refined by Generative Answers, is presented to the user as an answer to their query.

Email Drafting with Attachment by Using Copilot Studio

Here, Generative Answer uses the User’s Query and File content to generate the answer the query asked by the User.

Email Drafting with Attachment by Using Copilot Studio

The extracted information from the local documents, refined by Generative Answers, is presented to the user as an answer to their query.

With essential project data now accessed, the subsequent typical need is to share this comprehensive report with stakeholders. While a brief email can offer rapid updates, writing a contextual email often becomes time-consuming and prone to errors. Our mission is to facilitate effortless, effective, and professional conveyance of extensive information.

Imagine this scenario: You’ve just employed the Copilot to get the “scope of XYZ-IPD-01” as in our earlier scenario, and the results come in a cleanly written summary. Rather than writing it yourself, you just instruct your Copilot: “Draft an email with the above information.”

Email Drafting with Attachment by Using Copilot Studio

On receiving your command, the Copilot automatically initiates a Power Automate flow to compose the content of the email. You will be given a link, and clicking it will directly launch Outlook, showing you a pre-populated email, complete with body and subject

Email Drafting with Attachment by Using Copilot Studio

Let’s examine how this setup is carried out. This process is automated using Microsoft Power Automate (Flows), triggered from within Copilot Studio, for which we have created a dedicated topic.

Email Drafting with Attachment by Using Copilot Studio

The topic triggers a Power Automate Flow Action, which uses “Send an HTTP Request” to create a draft email

Email Drafting with Attachment by Using Copilot Studio

A unique link is provided to the user, which, when clicked, opens Outlook with the email’s subject and body pre-filled, ready for sending

Conclusion

This solution streamlines how we retrieve and first exchange information from on-premises document stores. Using Microsoft Copilot Studio, Power Automate, and a secure On-Premises Data Gateway, the system enables real-time data retrieval and seamless email drafting. It is a more efficient, streamlined workflow for handling mission-critical information.

Category: Copilot Technical Tags:

About Sam Kumar

Sam Kumar is the Vice President of Marketing at Inogic, a Microsoft Gold ISV Partner renowned for its innovative apps for Dynamics 365 CRM and Power Apps. With a rich history in Dynamics 365 and Power Platform development, Sam leads a team of certified CRM developers dedicated to pioneering cutting-edge technologies with Copilot and Azure AI the latest additions. Passionate about transforming the CRM industry, Sam’s insights and leadership drive Inogic’s mission to change the “Dynamics” of CRM.