In today’s fast-paced work environment, keeping everyone updated with the latest news and announcements is crucial. With Power Automate, you can streamline the process of creating news posts in SharePoint directly from Outlook emails. This automation saves time and ensures that important information is shared quickly and efficiently. This blog walks you through the steps to set up this efficient integration.
What You’ll Need
Power Automate: Included with most Microsoft 365 plans for creating automated workflows.
SharePoint Site: The destination site where your news articles will be published.
Outlook Account: A Microsoft 365 Outlook account to receive emails.
Step-by-Step Guide to Create Your Flow
Step 1: Set Up the Trigger
Begin by signing in to Power Automate and creating a new flow using the "When a new email arrives" trigger from Outlook. You can set specific conditions to filter the emails that will initiate the flow, such as emails with a particular subject line (e.g., "News Update")
Step 2: Extract Content and Attachments
After setting the trigger,
Outlook Attachments:
Add a "Get Attachment (V2)" action to set the "Message Id" and “Attachment Id” in theaction.
Use an "Apply to each" action to iterate through theattachments.
Add a "Create file" action to store the Outlook attachment(image.png) in SharePoint, specifying the Site Address, Folder Path, File Name, and File Content. Then, use a "Get files (properties only)" action to retrieve the properties of the uploaded image for use in the news post.
Getting Outlook Content: After retrieving the Outlook content, it's in HTML format.
Converting HTML to Text: Use the "Html to text" action to convert the HTML content into plain text format.
Removing Line Break Spaces: To handle the line breaks (which may appear as unwanted spaces), you can add a "Compose" action to cleanup the content.
Expression for Cleaning Spaces: Use the expression: replace(outputs('HtmlToText'), decodeUriComponent('%0A'), ' ') This expression replaces the encoded line breaks with space. The final output from the Compose action will be used as the content for your news post.
Step 3: Create the News Post in SharePoint
Next, Creating a news post in SharePoint. Below is a general guide to help you set up a flow that creates a news post in SharePoint:
Add the "Send an HTTP request to SharePoint" action.
Enter your SharePoint site address and select the HTTP method.
Specify the URI and include any required headers and body.
Next, we need to add an HTTP request action for creating the news post layout.
And then In Body, set the “Outlook Content” and “Get files” image file
After publishing the POST, we need to add another 'Send an HTTP request to SharePoint' action to publish the news post.
By integrating Outlook with SharePoint through Power Automate, you can create a seamless flow of information that enhances communication within your organization. Automating the creation of news posts not only saves time but also ensures that everyone stays updated with the latest news and announcements.