sp-dev-fx-webparts/samples/react-graph-cascading-manag...
Hugo Bernier 94a40c6036
Merge pull request #4776 from pnp/dependabot/npm_and_yarn/samples/react-graph-cascading-managed-metadata/es5-ext-0.10.63
Bump es5-ext from 0.10.53 to 0.10.63 in /samples/react-graph-cascading-managed-metadata
2024-03-06 22:34:21 -05:00
..
.devcontainer
assets Changed docs links to learn 2022-10-24 09:42:45 -04:00
config
fast-serve
src
teams
.gitignore
.npmignore
.yo-rc.json
README.md Added more contributions 2023-03-15 01:23:34 -04:00
gulpfile.js
package-lock.json Merge pull request #4776 from pnp/dependabot/npm_and_yarn/samples/react-graph-cascading-managed-metadata/es5-ext-0.10.63 2024-03-06 22:34:21 -05:00
package.json Bump postcss, @microsoft/sp-build-web and spfx-fast-serve-helpers 2023-10-03 18:58:44 +00:00
tsconfig.json
tslint.json
webpack.js

README.md

Cascading managed metadata using Graph API (beta)

Summary

This web part shows how to use the Microsoft Graph APIs (beta) for Taxonomy to get the data.

Functionality

Cascading managed metadata

Compatibility

⚠️ Important
Every SPFx version is only compatible with specific version(s) of Node.js. In order to be able to build this sample, please ensure that the version of Node on your workstation matches one of the versions listed in this section. This sample will not work on a different version of Node.
Refer to https://aka.ms/spfx-matrix for more information on SPFx compatibility.

SPFx 1.14 Node.js v14 | v12 Compatible with SharePoint Online Does not work with SharePoint 2019 Does not work with SharePoint 2016 (Feature Pack 2) Local Workbench Unsupported Hosted Workbench Compatible Compatible with Remote Containers

Applies to

Pre-requisites

  • Set up the termset structure as shown in the image below - .
  • To the termset, add a custom property called UsedForShowingMaps and set it's value to true as shown in the image below Term store properties
  • For the cities, get the required latitude and longitude.
  • Add 2 custom properties for the city terms latitude and longitude (as highlighted for the term London in the image below). Term store

Contributors

Version history

Version Date Comments
1.0.0 Aug 24, 2020 Initial release
1.0.1 Sep 03, 2020 Error handling and logging improvements
2.0.0 Mar 04, 2022 Updated to SPFx 1.14, used term custom properties to get co-ordinates (as Graph API provides that capability now), usage of PropertyFieldGuid and several other improvements

Minimal Path to Awesome

  • Clone this repository
  • in the command line run:
    • npm install
    • gulp serve
  • Make sure you have completed the pre-requisites
  • Add the web part to the workbench page of a site
  • Edit the web part and add the termset id in the properties

This sample can also be opened with VS Code Remote Development. Visit https://aka.ms/spfx-devcontainer for further instructions.

Features

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

  • Get termset, terms and their custom properties using Microsoft Graph API (beta).
  • React Hooks
  • Using async / await for the async calls
  • Caching the data in session storage
  • Usage of PnP SPFx controls (Maps and Placeholder)
  • Office UI fabric components

Enhancements

  • Currently, this web part supports 2-level cascading. So there is scope to enhance this such that it supports more levels of cascading dynamically.

Video

Cascading managed metadata using Microsoft Graph and SharePoint Framework

Need to show more details?

An Adaptive Card Extension (ACE) which performs similar operations and provides more data like the local time of the office, weather data of the office location and address of the office location along with it's map can be found in the Office locations sample of pnp/sp-dev-fx-aces repostory.

Help

We do not support samples, but we this community is always willing to help, and we want to improve these samples. We use GitHub to track issues, which makes it easy for community members to volunteer their time and help resolve issues.

If you're having issues building the solution, please run spfx doctor from within the solution folder to diagnose incompatibility issues with your environment.

If you encounter any issues while using this sample, create a new issue.

For questions regarding this sample, create a new question.

Finally, if you have an idea for improvement, make a suggestion.

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.