Sentiment Analysis With SharePoint

Introduction

 
MS Azure Sentiment analysis helps to evaluate the user input. It returns a sentiment score in the range of 0 (negative) to 1 (positive). This helps in analyzing user feedback.
In this article, we will use a SharePoint list as a backend to collect user feedback. The feedback will be then sent to Azure Sentiment analysis using Power Automate and stored back the response in the SharePoint list.
 

Create Sentiment Analysis resource in MS Azure

 
Follow the below steps to set up Sentiment Analysis API.
 
Create a resource
  1. Login to Microsoft Azure Portal (https://portal.azure.com).
  2. Click Create a resource.
  3. Choose AI + Machine Learning
  4. Choose Text Analytics.
Sentiment Analysis With SharePoint
 

Create a Text Analytics

  • Fill in the details to create the Text analytics API.

    Sentiment Analysis With SharePoint

  • The parameters are as follow:
    • Name: The Unique name of Text analytics API.
    • Subscription: Select Azure subscription to create Text analytics under it.
    • Location: The location to host Text analytics API.
    • Pricing tier: Select tier as per features you want to use. More details at https://azure.microsoft.com/en-us/pricing/details/cognitive-services/text-analytics/
    • Resource group: Select an existing or create a new resource group.

  • Click Create.
  • Once the deployment finishes, the Text analytics resource will be available to use.
  • Note down the API Key and endpoint to authenticate your applications and start sending calls to the service.

Test the Computer Vision

 
We will use the API Console to quickly try the API without writing any code.
  • From the left menu, select Quickstart.
  • Click API Console (V2).
  • Select the testing console in the region where you created your resource.

    Sentiment Analysis With SharePoint

  • The selection of the region will form the request URL.
  • Specify the resource name and query parameters.
  • Specify the API key in Headers.

    Sentiment Analysis With SharePoint
  • In the request body, provide the custom text to analyze or use the default one. 

    Sentiment Analysis With SharePoint

  • Click Send.
  • The response will be shown as follows,

    • SharePoint list schema
    • Create a SharePoint list with below schema,

      Sentiment Analysis With SharePoint

Set up Power Automate Flow

 
Now we will set up Power Automate flow to integrate Text analysis API for analyzing user feedback submitted to the SharePoint list.
 
Follow the below steps to set up Power Automate flow:
  • On the SharePoint list, click Automate > Power Automate > Create a flow.
  • Select a template “When a new item is added in SharePoint, complete a custom”.
  • Verify your connection to SharePoint. 
  • Click Continue.
  • Add an activity “Text Analytics”, select action “Detect Sentiment”.

    Sentiment Analysis With SharePoint

  • Specify the connection name, Key from Azure, and Azure endpoint.

    Sentiment Analysis With SharePoint 

  • Click Create.
  • Specify the SharePoint list column Feedback as Text. Optionally specify the language of feedback.

    Sentiment Analysis With SharePoint

  • Add an entry to the SharePoint list. This will trigger a flow. The OUTPUTS section will show the Score from Text Analytics API.

    Sentiment Analysis With SharePoint

  • Add an activity Update item available under the SharePoint category.

    Sentiment Analysis With SharePoint
 
Test the Solution
 
In the SharePoint library, add a new item as user feedback. This will trigger a flow. A flow will call Sentiment analysis API for analyzing the feedback submitted to SharePoint.
 
The flow will then update the returned metadata to the SharePoint column inside the list with a sentiment score.
Sentiment Analysis With SharePoint
 

Summary

 
Azure Sentiment analysis API helps to analyze the text input submitted to SharePoint and evaluate the user input and returns the sentiment score in the range of 0 (negative) to 1 (positive).
 
References