SharePoint Online – Analyze User Feedback using Sentiment Analysis API and Microsoft Flow

The Sentiment Analysis API provided by Microsoft evaluates text input and returns a sentiment score for each document, ranging from 0 (negative) to 1 (positive). This capability is useful for detecting positive and negative sentiment in social media, customer reviews, and discussion forums. In this article I am going to show you how to send the feedback entered in a SharePoint online modern list item to Sentiment Analysis API and update the response back in SharePoint. Also I am going to show how to beautify the Sentiment score with emojis using column formatting feature.

Create a SharePoint list with the following columns

columns.PNG

At the top of the list, click Flow, and then click Create a flow.

newflow

Select the below flow template from the right-hand panel.

select flow type.PNG

Follow the instructions on the Microsoft Flow site to connect to the list we have created. Credentials will be verified for each service used in the flow. For Office 365 services such as SharePoint and Outlook, connections will be created automatically. The next steps will be performed in the Microsoft Flow designer. The first action displayed, also known as a trigger, will determine how the flow will be started. Additional actions may be added after the first. Each new action will be dependent on the previous action.

add new step.PNG

Next step is to add an initialize variable action to set the value of the current Item Id.

setitemid.PNG

Create a POST request using a HTTP action. Set the HTTP Method, URI, Headers and Body as shown below:

Note: Login to Azure and get the Ocp-Apim-Subscription-Key. Refer this article for steps.

CallSentimentAPI.PNG

Now let us parse the sentiment score from the response we received from the HTTP action and save the value in a variable using initialize variable action as shown below

SetSentimentScore.PNG

Expression : body(‘CallSentimentAPI’)[‘documents’][0][‘score’]

Here CallSentimentAPI is HTTP action name.

Let us update the sentiment score in the list item using a Send an HTTP request to SharePoint action as shown below

update list item.PNG

Save the flow and go back to the list.

Let us create a new item in the SharePoint list to check the sentiment score for our feedback

new item.PNG

If all goes well, we should see the sentiment score in the list column as shown below

data.PNG

We can check the status of every execution in the flow history as shown below

status.PNG

success run.PNG

To beautify the sentiment score with emojis, we can use SharePoint column formatting feature as shown below

column formatting

I have used the following column formatting formula to convert the sentiment score into emojis

formual.PNG

Hope you liked this post. If you have any questions on sharepoint or office 365, please let me know.

Azure Traffic Manager for Provider Hosted Apps – Global Load Balancing

Microsoft Azure Traffic Manager allows us to control the distribution of user traffic to the specified endpoints (Zone Specific Azure Sites).

Azure Traffic Manager gives us three traffic routing methods to choose from:

  • Failover
  • Performance
  • Round robin.

We can choose the one that is right for our application or scenario.

Advantages

  • Traffic Manager can improve the availability of important applications by monitoring our Azure sites and automatically directing users to a new location anytime there is a failure.
  • Traffic Manager makes applications more responsive and improves content delivery times by directing users to an Azure or external location with the lowest network latency.
  • Traffic Manager can direct user traffic to distribute it across multiple locations

Steps to load balance provider hosted apps

drawing1.png

Reference

https://azure.microsoft.com/en-us/documentation/articles/traffic-manager-manage-profiles/

Deploying Multiple Provider Hosted Apps to a Single Azure Web Site

Is it possible to host Multiple Provider Hosted Apps to a Single Azure Web Site?

The answer is Yes. If yes how?

Here you go…..

  • Create Azure Site
  • Create Required App Folders
    1. Go to azure web site
    2. Click on the Configure link in the top navigation for the web site
    3. Scroll to the bottom of the page and enter the values for your new virtual paths as shown below:

1

Note: Make sure you check the Application checkbox.

  • Register your apps using appregnew.aspx page as shown below

2.png

Note: Here I am adding my virtual directory sub folder name(App1 and App2) after azure website URL.

  • Your app manifest file should look like this

3.png

Note: Here I am adding my virtual directory sub folder name(App1 and App2) after ~remoteAppUrl. If you don’t have Remote Event Receiver in your app, you do not need to configure InstalledEventEndpoint and UninstallingEventEndpoint.

  • Publishing configuration(App Web Project) should be something like this

4.png

Note: Here I am adding my virtual directory sub folder name(App1 and App2) after site name.

  • Finally the app package configuration should be like this

5.png

Note: Here I am NOT adding my virtual directory sub folder name(App1 and App2).

Let me know if you  have any questions on this.

Provider Hosted App Deployment to Azure Website’s (One Azure site for multiple apps)

Deployment Steps

  • Create an Azure Website in Azure Portal. In this example, I am going to create an azure website with name “cloud-demo-providerapps”
  • I wish to use one azure website to host multiple provider hosted apps. So I am going to create separate folders to deploy my provider hosted app files as shown below: (In this example, I am going to deploy my provider hosted app files under “AzureDeployTest” folder.)

Note: It is mandatory to check the application checkbox

  • To prepare the build, create a new folder in your system(laptop/server). In this example the folder name is “SPOL_Stage_Build_09252015V01
  • Download the azure website profile from azure portal and paste it inside the “SPOL_Stage_Build_09252015V01” folder. In this example my azure profile name is “cloud-demo-providerapps.azurewebsites.net.PublishSettings

         Note: This will be done by admin team. So include this in the deployment instruction.

  • Create a XML file inside the “SPOL_Stage_Build_09252015V01” folder with name “xml” and configure the XML file in the below format

<?xml version=”1.0″ encoding=”utf-8″?>
<parameters>
<setParameter name=”IIS Web Application Name” value=”cloud-demo-providerapps/AzureDeployTest” />
</parameters>

Here cloud-demo-providerapps is the azure website name and AzureDeployTest is the folder where I wanted             to place my provider app files.

  • Download the below PowerShell script from my one drive and paste it inside the “SPOL_Stage_Build_09252015V01” folder

        Publish-AzureWebApp.ps1

  • Package the provider hosted web project and paste the zip file inside the “SPOL_Stage_Build_09252015V01” folder. In this example my package file name is “AzureDeployTestWeb.zip

Note: This will be done by development team.

  • At this point my build should be ready as shown below
  • Open the Windows PowerShell IDE and navigate to the “SPOL_Stage_Build_09252015V01” folder location
  • Execute the following command

.\Publish-AzureWebApp.ps1 -WebDeployFile AzureDeployTestWeb.zip –SetParametersFile config.xml -PublishSettingsFile cloud-demo-providerapps.azurewebsites.net.PublishSettings

  • If everything works fine, deployment artifacts should be deployed to the target folder and you should see the success message in the powershell IDE.

How to Package and Deploy Provider Hosted Apps

This article provides the steps to package and deploy Provider Hosted App.

I assume you are aware of the following:

  • Provider Hosted Environment readiness
  • IIS site setup for remote web deployment
  • Provider Hosted App Project Setup using VS 2013
  • Registering an app in the App Registration Page
  • Setting up Publishing Profile (using high trust certificate)
  • Package and deploy the .app file in App Catalog from SharePoint Project

Steps to Package & Deploy

  • Right click on the Web Project and select Publish

1-provideapppackage.png

  • Click Next (Note: If required update the IIS Web Application Name, ClientId, ClientSigningCertificatePath, ClientSigningCertificatePassword and IssuerId in the publishing profile. In my case, I have configured all these during the project creation)
  • In the connection tab select the Publish method as “Web Deploy Package” and update the Package location & Site name as per your environment (refer the below example). Click Next

2-provideapppackage4.png

  • Select “Release” in the Configuration drop down and click Publish

3-provideapppackage1.png

  • Now your package should be ready at the package location you have configured in the previous step

4-provideapppackage2.png

  • Copy the app remote web package to the remote web server you wish to deploy
  • Open the Command Prompt and traverse to the directory containing the package files
  • Run the following command:  <Command File Name> /y

Example: SiteProvisioningWeb.deploy.cmd /y

  • Now the deploy command should have deployed the files in the remote web server IIS website.
  • Access the app and make sure the app is working with the logic you have written.