Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Part IV of the Security Classification Extension
import * as React from "react";
import { IClassificationHeaderProps, IClassificationHeaderState, DefaultClassification } from "./ClassificationHeader.types";
import { MessageBar, MessageBarType } from "office-ui-fabric-react/lib/MessageBar";
import { Link } from "office-ui-fabric-react/lib/Link";
import { Web } from "sp-pnp-js/lib/pnp";
import { ClassificationPropertyBag } from "../../../../lib/extensions/classificationExtension/components/ClassificationHeader.types";
export default class ClassificationHeader extends React.Component<IClassificationHeaderProps, IClassificationHeaderState> {
constructor(props: IClassificationHeaderProps) {
this.state = {
isLoading: true,
businessImpact: null
public componentDidMount(): void {
isLoading: true,
businessImpact: null
const web: Web = new Web(this.props.context.pageContext.web.absoluteUrl);"Title", "AllProperties")
.then(r => {
var businessImpact:string = DefaultClassification;
// handle the default situation where there is no classification
if (r.AllProperties && r.AllProperties[ClassificationPropertyBag]) {
businessImpact = r.AllProperties[ClassificationPropertyBag];
isLoading: false,
businessImpact: businessImpact
console.log("All properties results", r);
public render(): React.ReactElement<IClassificationHeaderProps> {
return (
This site is classified as {this.state.businessImpact}. <Link href="">Learn more about the proper handling procedures.</Link>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment