Are you looking to streamline your news-sharing process? In this step-by-step guide, we’ll show you exactly how to post news links to SharePoint using Power Automate, saving you time and keeping your team informed effortlessly.
Use Case
Want to automatically share updates from your company or industry websites, but there’s no RSS feed or API available? Manual sharing on SharePoint for each new piece is tedious, so let’s explore how to automate.
Step 1 – Calling the Website
There are a few different ways to achieve this, but let’s use the HTTP action to directly call the site page that has the news we are looking for.
This will return the HTML of the page, and allow you to start the process of finding the unique content around the News section that will allow you to grab just the News content out of the full HTML.
Step 2 – Locate the News Section in the HTML
To do this, you’ll need to run your workflow and carefully inspect the HTML step’s output. Look for consistent patterns or identifiable tags that encapsulate the news content you want to share.
Once you’ve identified these unique tags, you can utilize Power Automate’s substring function to extract just the news section from the larger HTML content. This targeted approach ensures that only the relevant information is pulled and posted to your SharePoint site. For example, you might find that the news section is wrapped in a specific <div> tag with a unique class or ID. By using these identifiers in your substring function, you can precisely extract the desired content, eliminating any extraneous information and streamlining your automated news-sharing process.
Step 3 – News Extraction
Next use, the HTML to Text converter to get the HTML into a more workable format.
The key objective in this step is to effectively use the Substring action in Power Automate to extract precisely the news content you want. To achieve this, you’ll need to determine two crucial pieces of information: the starting position of the news content within the converted HTML, and the length of the news section. The length is calculated by subtracting the starting position from the ending position of the news content. By inputting these parameters into the Substring action, you’ll be able to isolate and extract just the text containing the news itself, without any surrounding HTML or irrelevant content.
Step 4 – Adding News Links to an Array
Using a compose action to hold the values for the next step, use the code below to split the text:
split(outputs('Substring')?['body'],decodeUriComponent('%0A'))
After splitting, add a condition similar to the below to only append links to the array variable itself and leave the other items that come along behind.
Step 5 – Post News to SharePoint
Finally, loop through the array and add a “Send HTTP to SharePoint” action to create a page for each news link that appears.
Conclusion
This automation ensures quick and consistent sharing of critical news and creates a more connected, informed workplace. Success comes from fine-tuning the workflow to your needs and SharePoint setup. Facing challenges? Need help customizing? Don’t hesitate to ask. We’re here to help you get the most from Power Automate and SharePoint. Share your experiences in the comments. Ask questions. Tell us how this automation has improved your team’s information flow.
0 Comments