OpenAI APIs & Power Automate for SharePoint Test Documents
Image Source:
SharePoint Online
Sep 27, 2023 6:14 PM

OpenAI APIs & Power Automate for SharePoint Test Documents

by HubSite 365 about Nanddeep Nachan [MVP]

Microsoft MVP (M365 Apps & Services) | MCT | Consultant - M365, SharePoint, MS Azure, Power Platform | Public Speaker | Published Author | Blogger

Pro UserAll about AISharePoint OnlineM365 Hot News

Learn to generate SharePoint test content using OpenAI APIs and Power Automate for efficient document creation and automation.

Summary: Streamlining Content Generation on SharePoint Using OpenAI and Power Automate

SharePoint often requires the creation of test content tailored to a specific topic. OpenAI APIs, when amalgamated with Power Automate, can auto-generate such content. This post will elucidate the procedure to combine these powerful technologies.

OpenAI API operates with an API key, which can be procured by signing up at OpenAI and generating a secret key from the 'View API Keys' option in the profile. Testing can be performed in the OpenAI Playground before integrating it into the application.

For our purpose, we will design a Power Automate flow, issuing a request to OpenAI API. This process entails making two distinct calls to OpenAI API to craft a document (.txt) in SharePoint.

The first call generates a specific number of random words, while the second scribes an essay based on each of these words. Setting up this flow requires creating an 'instant cloud flow' initially and defining variables to store the number of documents generated.

Next, an HTTP post request is issued towards OpenAI API to gather the random words. The flow is then executed manually to ensure functionality. JSON is used to parse the gathered output, which is then stored in a variable after parsing it through a replace function.

Further, we separate the comma-delimited words string into an array stored in a variable. Employing the 'Apply to each' action, we iterate over each word, calling OpenAI API to write an essay on it.

After running this Power Automate flow, the test document can be generated in SharePoint’s Library using the 'Create file activity'. Post flow execution, the outcome is a freshly-minted test document in SharePoint.

The integration of OpenAI API with Power Automate offers an ideal solution to generate content pertinent to any topic on SharePoint.

Deep Dive: Harnessing the Power of OpenAI for Automated Content Generation

With digitalization shaping the modern workspace, the need for automated solutions is escalating. As businesses increasingly depend on content-related tasks, the demand for automated content generation sees a surge.

SharePoint has been the go-to platform for content management and collaboration. But with OpenAI and Power Automate in the picture, these regular tasks transform into a streamlined process. A simple enlistment of steps to create an instant cloud flow makes this transformation feasible.


OpenAI API, a powerful machine learning model, stands in the center of this solution. Geared with the capability to produce human-like text, OpenAI allows creating meaningful content for various purposes. Combined with Power Automate's automation capabilities, the process simplifies content generation on SharePoint.

Although the task sounds complex, adopting these steps will greatly simplify the process. The ease of implementation, combined with the infrastructure of SharePoint, results in efficient content creation, reducing manual labor, and exponentially improving productivity. Read the full article Create Test Documents in SharePoint with OpenAI APIs and Power Automate

SharePoint Online - OpenAI APIs & Power Automate for SharePoint Test Documents

Learn about Create Test Documents in SharePoint with OpenAI APIs and Power Automate

Building test content on SharePoint has never been easier with the advent of OpenAI's API. When combined with Power Automate, you can generate content tailored for any topic, making this a powerful tool for content management.

Begin by acquiring an API key from OpenAI. Navigate to OpenAI's website, sign up and look for 'View API Keys' in your profile. Create a new secret key, which you'll need in later stages. Before diving into application, take a detour to the OpenAI Playground. It serves as an excellent sandbox for you to familiarize with the API functions.

Want to view the code? Excellent! Several language options like Python, Node.js, and more are available. From these, the 'curl' option offers detailed guidance on header parameters. For our purposes with Power Automate, Json format is the recommendation.

Let's move on to creating a Power Automate flow for OpenAI API. The objective? Making two calls to OpenAI APIs to generate a document in SharePoint, specifically a .txt file. First, we generate several random words. Then, an essay is generated for each of these words.

First and foremost, an instant cloud flow is created with input as a question. Following the instantiation, a variable is then defined to store the number of documents to generate. The HTTP action is employed to post the request to OpenAI API, resulting in random words from OpenAI. Upon running the flow, check the result. Snip the body content from the HTTP request output for use in the next steps.

JSON parsing becomes the focus next, as you seek to extract output. Similarly, a variable is initialized with an expression to store the response i.e randomly generated comma-separated words from Open AI. The comma-separated word string is then segmented results into an array stored in a variable.

Upon the usage of the 'Apply to each' action to sift through each word, make another call to OpenAI API to draft an essay on each word. Upon wrapping up the call, the resultant test document, in .txt format, can be produced in SharePoint document library thanks to the 'Create File' activity.

The outcome? An array of test documents within the SharePoint document library. OpenAI API paired with Power Automate surely proves to be a commendable solution to content generation. Want to explore further? Check out OpenAI's website!

More links on about Create Test Documents in SharePoint with OpenAI APIs and Power Automate

Create Test Documents in SharePoint with OpenAI APIs ...
Feb 12, 2023 — In this article, we will explore how OpenAI API can be combined with Power Automate to generate content in SharePoint. Get the API Key. Follow ...
Create sample documents in SharePoint with OpenAI
May 31, 2023 — The below script shows how OpenAI can be combined with CLI for Microsoft ... generate test documents in SharePoint. Prerequisites: OpenAI API key.
Create Test Documents in SharePoint with OpenAI APIs ...
Introduction While working with SharePoint, we most times need to create test content related to a specific topic. OpenAI API is the best fit.


SharePoint Test Documents, OpenAI APIs, Power Automate, SharePoint with OpenAI, Power Automate API, OpenAI Test Documents, Create SharePoint Documents, Automate SharePoint Process, OpenAI with Power Automate, Power Automate Documents