Find file History

README.md

Spfx Field Customiser sample using Text Analytics API

Summary

This sample shows how to use the Text Analytics API (Cognitive Services) to render a sentiment icon based on the text of a field in the List. The language is also auto-detected using the API, so it works with text based in any language supported by the API.

Field Customiser using Text Analytics API

Used SharePoint Framework Version

SPFx v1.4

Applies to

Solution

Solution Author(s)
react-field-text-analytics-api Luis Mañez (MVP, ClearPeople, @luismanez)

Version history

Version Date Comments
1.0.0 January 7, 2018 Initial release
2.0.0 January 18, 2018 Language auto-detection added

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.


Prerequisites

Minimal Path to Awesome

  • register a Cognitive Services Vision API in your Azure subscription
  • create a List and add a Field called "SPFxSentimentIcon" (type: Number)
  • clone repo
  • update serve.json pointing to your List URL, Text Analytics API Key, and Field name to analyse
  • run gulp serve --configuration=sentimentAnalytics

Features

Sample SharePoint Framework list field customiser calling the Cognitive Services Text Analytics API and showing the sentiment of the Text with an Icon.

This sample illustrates the following concepts on top of the SharePoint Framework:

  • using Text Analytics API to get the sentiment score from a given Text
  • using async / await for the async calls

Well-Known issues

Depending on the number of items in the list, you could get a 429 Too Many Request response when calling the API.

Interesting links