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.

Add Modern SharePoint Site Page in Microsoft Teams

Microsoft Teams is a chat-based workspace that brings together people, conversations, content, and tools for easier collaboration. SharePoint sites include the modern page feature, which allow you to engage the team members with important or interesting stories. Here I am going to show you how to display a SharePoint modern page with in teams as a tab.

I have created a SharePoint modern page as show below:

samplemodernpage.png

Set up SharePoint Modern Page in Teams

  • In Teams, navigate to the team where you want your SharePoint page to appear.

teams1.PNG

  • Click the plus sign to add a new tab.

teams2

  • Click on Website

teams3.png

  • Provide a Tab name and SharePoint Modern page url and click Save. Optionally we can select Post to the channel about this tab check box to communicate this change with the users.

teams4

  • That’s it! Now, every time you visit your team, the newly added tab will appear as part of the teams as shown below

teams5.png

  • You can use the expand / collapse button to view the content the way you like

teams6

Notes :

  • I don’t know if you noticed, but the out of the box sharepoint controls such as Suite Bar, Left Navigation, Search Box, Page Title Area and Command Bar are gone within teams.
  • If you have custom webparts within the page, you can not edit properties of those within teams.
  • You can not change the web part arrangement sequence within teams.
  • You can not display classic page.

Displaying SSRS Reports in External Applications using an iframe – SQL Server 2016

Problem Statement

After upgrading the SQL Server Reporting Service to 2016, the SSRS reports embedded in different applications including SharePoint pages using an iframe tag or page viewer web parts were stopped rendering.

iframe1.PNG

Error

erroriframe

Workaround Tried

I tried to fix this issue by adding the following entries in the rsreportserver.config but no luck.

report config file.png

The rsreportserver.config file is installed in the following location by default:

SharePoint Mode

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\WebServices\Reporting

Native Mode

C:\Program Files\Microsoft SQL Server\MSRS13.MSSQLSERVER\Reporting Services\ReportServer

Solution

Added rs:Embed=true as a query parameter at the end of the report URL and this fixed the issue and reports started working properly.

iframe2.PNG

SPFx Extension – Email Item/File URL

In SharePoint there used to be a ‘copy shortcut’ option in the right-click menu on a document. This feature is not available currently. Now we need to go to the share sub-menu to get a link to the document, but what is offered there is the docidredir link, not the full path.

This SPFx extension opens a dialog where the user can see the document full path. The Email Link button helps the user to share the link via default email client.

react-command-email-urlreact-command-email-url

Used SharePoint Framework Version

SPFx v1.6

Applies to

Solution Author(s)
react-command-email-url Joseph Velliah (SPRIDER, @sprider)

Version history

Version Date Comments
1.0 October 20, 2018 Initial release

Disclaimer

THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.

Minimal Path to Awesome

  • Clone this repository
    • Open serve.json file under config folder. Update PageUrl to the URL of the list you wish to test. react-command-email-url
  • Move to folder where this readme exists
  • In the command window run:
    • npm install
    • gulp serve

Features

This project contains SharePoint Framework extensions that illustrates the following features:

  • Command extension
  • Office UI Fabric React

Notice. This sample is designed to be used in debug mode and does not contain automatic packaging setup for the “production” deployment.

SharePoint Framework Web Part – Continuous Integration and Delivery

Continuous Integration and Delivery are the foundations of Modern Software Development. Continuous Integration and Delivery process is going to help your team in the following aspects:

  • Revision Control
  • Build Automation
  • Automated Deployment
  • Reduced Overhead
  • Consistent Build Process
  • Confidence and Team Communication
  • Risk Mitigation

In this article, I am going to show you how to set up Continuous Integration and Delivery for SharePoint Framework Web Part.

Tools Needed 

  1. Visual Studio Team Service – Source Control System
  2. Visual Studio Code – Code Editor
  3. SharePoint Framework Development Environment – Refer
  4. Git Repository Project in Visual Studio Team Service(VSTS)
  5. Git Commands
  6. A SharePoint Document Library that acts as a CDN
  7. SharePoint App Catalog Site
  8. A SharePoint Site to test the app

SharePoint Framework(SPFx) Git Project Configuration

The first step is to create a SPFx Git Repository Project in VSTS.

snip20170818_1.png

(Example)

Let us clone the newly created Git project into your favorite local folder using the following git command

git clone -b master repopath

SharePoint Framework(SPFx) Web Part Setup

Go to the project directory using command prompt/ terminal and set up your SPFx Web Part project as explained here. I am going to use my sample code here but feel free to write your own logic in your SPFx Web Part.

This is my project folder structure

snip20170818_4.png

One Time Activity

Let us package artifacts and upload the files in app catalog site and CDN library.

Open the write-manifests.json file under config folder and update the cdnBasePath parameter with your CDN SharePoint Document Library path.

snip20170818_8.png

Make sure you are still in the project directory you used to set up your web part project. In the console window, execute the following gulp task:

snip20170818_9.png

This will build the minified assets required to upload to the CDN library in temp\deploy directory. Go to your CDN SharePoint Library and upload the generated files.

snip20170818_11.png

snip20170818_14.png

In the console window, execute the following gulp task to package your client-side solution that contains the web part:

snip20170818_10.png

The command will create the .sppkg package file in the sharepoint/solution.

snip20170818_12.png

Go to your App Catalog site and upload the generated .sppkg file to the App Catalog. This will deploy the client-side solution package. SharePoint will display a dialog and ask you to trust the client-side solution to deploy. Click deploy.

snip20170818_13.png

At this point the web part is ready to be used on a page. Open a site where you want to test the web part and go the Site contents page of the site. Choose Add – App from the toolbar and choose the your app to be installed on the site.

snip20170818_16

After the app has been installed, add the webpart in a page

screen-shot-2017-08-18-at-10-36-17-am.png

Check-in the code and push the same to master branch via Visual Studio Code editor.

Climax

At this point we are ready integrate our SPFx web part project repository with VSTS continuous build and release process.

Gulp Tasks

Upload the highlighted custom gulp tasks provided by Elio Struyf and install the necessary npm packages as per the instruction given.

snip20170818_7.png

Update the gulpfile.js as shown below:

snip20170818_6.png

Continuous Integration and Delivery Setup in VSTS

Switch back to VSTS

Go to build & release section and click New buttonscreen-shot-2017-08-18-at-10-43-52-am.png

Select the empty template and click Apply.

Variables

Configure the following variables for the build and release. Adjust the values as per your environment.

snip20170818_28.png

Tasks

Add the following tasks and configure it as shown below

Process

snip20170818_19.png

Get Sources

snip20170818_20.png

NPM Install – npm

snip20170818_21.png

Update CDN Location – Gulp 

snip20170818_22.png

Bundle Project – Gulp

snip20170818_23.png

Package Solution – Gulp 

snip20170818_24.png

Upload Files in CDN – Gulp

snip20170818_25.png

Upload App Package to App Catalog – Gulp 

snip20170818_26.png

Deploy App – Gulp 

snip20170818_27.png

Trigger

Also enable the continuous integration settings so that the build process starts when the latest code is checked-in in master branch.

snip20170818_29.png

All done. Now it is time to test our continuous build and release process by pushing a new code change to git repository and check build process get triggered.

Code Change 

Let us change the progress bar color to red and check-in the latest change to git.

screen-shot-2017-08-18-at-11-23-24-am.png

Commit & Push Code Changes 

screen-shot-2017-08-18-at-11-26-05-am.png

screen-shot-2017-08-18-at-11-26-25-am.png

Build and Release Status

screen-shot-2017-08-18-at-11-30-18-am.png

snip20170818_31.png

snip20170818_32.png

snip20170818_33.png

snip20170818_34.png

As you can see in the screenshot, the latest code got updated and progress bar color is reflecting.

Email Notification

snip20170818_35

Note: You can isolate the deployment process from the build process using a release template.

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/

SharePoint Online – Install / Upgrade App from App Catalog Out Of The Box

Scenario 

I want a custom app to be installed by default whenever a site is created with a specific site collection/managed path/template and users from that site should not remove that app from that site. The best way to implement this is to create a feature stabling with custom site definition. Unfortunately, SharePoint Online does not support feature stabling or site definition.

Solution

As a SharePoint or global admin in Office 365, you can create an App Catalog site to make internally developed custom apps available for users to install when they browse apps under the From Your Organization filter on the Site Contents page. Site owners can then add these apps.

  • The first step is to create the App Catalog site collection if it hasn’t already been created.
  • Once the App Catalog has been provisioned, upload the first version(my first version: 1.0.0.0) of your app in the app catalog site.
  • Install the first version of your app in the app catalog site.
  • Select the ellipses ( …) next to the app, select the ellipses ( …) again in the callout to view the menu, and then select Deployment.

deployment.png

  • Now you will be redirected to the “Manage App Deployments” page where in you can configure where you wish to install the app. App can be installed with Site Collections, Managed Paths and Site Templatesbased scopes.

2.PNG

3.PNG

  • Configure the setting as per your requirement and click Ok  (if required trust the app)
  • In this example, I wanted to install my app in https://sharepointrider.sharepoint.com/sites/dev site collection under sites managed path with Developer Site templates only.
  • Now the app should be installed in the above said sites

Note: If you notice, the app information callout’s footer section is rendered only with an About callout action and user can not remove the app from the site.

version1.png

  • Now upload the next version(1.0.0.1) of your app in the app catalog site
  • Upgrade the app in the app catalog site

5

  • Now your app should get upgraded automatically in the sites you configured in step # 4.

version2.png

This approach provides the flexibility and governance for SharePoint add-in deployments.

Download SharePoint Online Files using MAC CURL Command

Problem Statement
MAC SharePoint users were downloading the files from SharePoint 2007 Document Libraries using the CURL command but the same is not working after migrating the SharePoint 2007 sites to SharePoint Online(SPOL).

Example

Screen Shot 2018-09-13 at 10.58.26 AM.png

Cause
SharePoint Online uses claims based authentication and direct NTLM based curl commands are not allowed.

Resolution
SPOL allows remote applications to call the REST API with user impersonation. This article demonstrates how to access SPOL REST API and download the files from a tenant using Apple Bash Script and Curl commands. However, outside of .NET the authentication piece is not so straightforward. App authentication solves this issue for registered apps but in this document you will see how remote user authentication can be achieved, regardless of platform.

The below diagram illustrates the HTTP requests which need to be made in order to authenticate SharePoint Online.

spolremoteauth

Applies To
Office 365 Tenant connected with Active Directory Federated Service(ADFS) and MAC OS

Execution Steps

  • Download the BashSPOLFileDownload.sh file from here
  • Open BashSPOLFileDownload.sh file in a text editor(TextWrangler/TextMate) and update the UserName (Line #4) and Password (Line #5).

remotecodebash

Note: The UserName & Password provided should have access to download the file from SharePoint Online.

  • To download the file from a different SharePoint Online site/library/folder/file where the account has access, change the values of EndPoint(Line #6) and FileServerRelativeUrl(Line #7) values.
  • Save the BashSPOLFileDownload.sh file
  • Open Terminal (command line tool) and go to the path where BashSPOLFileDownload.sh file is saved
  • Execute the following command to convert the BashSPOLFileDownload.sh file executable chmod 700 BashSPOLFileDownload.sh
  • Run the script using just the name of the script(Example : ./ BashSPOLFileDownload.sh)
  • If all goes well, you should be able to see the downloaded file in the output path given in OutputFilePath(Line #9).

Failure Chances

  • UserName and Password provided might be wrong
  • Access denied from SharePoint Online for the UserName and Password provided
  • Provided Site/Document Library/Folder/File is not available in SharePoint Online or wrong
  • Text Editor might have changed or corrupted the BashSPOLFileDownload.sh file while saving

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.