Init API permissions for your SPFx projects without deploying them

Published 03-10-2021 01:34 AM 1,056 Views
Occasional Contributor

When developing your SPFx components, you usually first run them locally before deploying them (really?).

 

And then comes the time to work with API such as Microsoft Graph.

 

If you never use those permissions before in your SPFx projects (and the tenant with which you're working), you realize that you have to:

  • Add required API permissions in your package-solution.json file
  • Bundle / Ship your project
  • Publish it
  • Go to the SharePoint Admin Center Web API Permissions page
  • Approve those permissions

 

All of this, just to play with the API as you didn't plan to release your package in a production environment.

 

So what if you could bypass all these steps for both Graph and owned API?

 

Warning

This trick is just for development purposes. In Production environment, you should update your package-solution.json file to add required permissions and allow them (or ask for validation) in the API access page.

 

Prerequisites

 

  1. An Office 365 (Dev) Tenant or a Partner Demo Tenant
  2. The following Azure AD role at least
    • Application Administrator

 

With Graph API

 

First, we're going to play with Graph API through the Microsoft Graph Toolkit.

 

Prepare your sample

Init a SPFx project (WebPart one with React, let's call it HelloApi), then add the Microsoft Graph Toolkit by executing npm i @microsoft/mgt @microsoft/mgt-react from the project's root path.

 

Once done, open your main component file (let's say here HelloApi.tsx) and add the PeoplePicker component like this:

 

import * as React from 'react';
import styles from './HelloApi.module.scss';
import { IHelloApiProps } from './IHelloApiProps';
import { escape } from '@microsoft/sp-lodash-subset';
import { PeoplePicker } from '@microsoft/mgt-react';

export default class HelloApi extends React.Component<IHelloApiProps, {}> {
  public render(): React.ReactElement<IHelloApiProps> {
    return (
      <div className={ styles.HelloApi }>
        <div className={ styles.container }>
          <div className={ styles.row }>
            <div className={ styles.column }>
              <span className={ styles.title }>Welcome to SharePoint!</span>
              <p className={ styles.subTitle }>Customize SharePoint experiences using Web Parts.</p>
              <p className={ styles.description }>{escape(this.props.description)}</p>
              <a href="https://aka.ms/spfx" className={ styles.button }>
                <span className={ styles.label }>Learn more</span>
              </a>
            </div>
          </div>
        </div>
        <PeoplePicker />
      </div>
    );
  }
}

 

Run it in remote workbench

Now run your sample with gulp serve and display your webpart in your remote workbench (https://contoso.sharepoint.com/_layouts/15/workbench.aspx). Try to use the PeoplePicker component: you'll see that just by clicking on the search box, you'll get We didn't find any matches.

 

peoplepicker-ui-fail.png

 

 

Display your developer toolbox (F12) and go to the browser console, you should see the following error:

 

peoplepicker-console-fail.png

 

As you can see, it's a 403 error, which is well-known when using Graph API endpoints that have not been allowed on the first place.

 

 

Add Graph API through UI

From the Azure portal, display the Azure Active Directory (AAD), then select the App Registration menu and select All Applications, then click on SharePoint Online Client Extensibility Web Application Principal. It's the AAD Application that holds the connection to the API (Microsoft and others) from SharePoint (SPFx or every other development) using the Implicit Flow.

 

Once here, click on Add a permission, then select Microsoft Graph and add the [People.Read] Graph API delegated permission (you can type the name of the permission in the available search box to get it easily).

 

aad-app-spo-api-graph.png

 

Once added, grant it by clicking on Grant admin consent for contoso.

 

If you go in the API access page (https://contoso-admin.sharepoint.com/_layouts/15/online/AdminHome.aspx#/webApiPermissionManagement), you should see something like this:

 

(other Graph API permissions displayed here won't be necessary for the sample)(other Graph API permissions displayed here won't be necessary for the sample)

 

Warning

It can take a couple of minutes before consented permissions is effective, so don't be surprised if it's not working right away after approval.

 

Add Graph API through CLI for Microsoft 365

 

m365 login # Don't execute that command if you're already connected
m365 spo serviceprincipal grant add --resource 'Microsoft Graph' --scope 'People.Read'

 

Info

Don't be surprised if by that way, the permission appears in the "Other permissions granted for [your tenant]": it won't prevent your SPFx solution to work.

 

Try again

Now try to use the PeoplePicker component again: you'll see that with the addition of the Graph API permission, you should be able to use that component!

 

peoplepicker-ui-success.png

 

With custom API

 

When using a custom API, it's a little bit more tricky but easy to handle anyway.

 

You can follow this Microsoft article until the "Deploy the solution" part.

 

Instead of bundling and shipping, we'll add the AAD App (called contoso-api-dp20200915 if we follow the mentioned article) created from the Azure Function Authentication part in the SharePoint Service Principal.

 

Add your AAD Application to the SharePoint Service Principal

Display again the AAD page, then select the App Registration menu, select All Applications and click on SharePoint Online Client Extensibility Web Application Principal. Once here, click on Add a permission, then select the My APIs tab and select the fresh added AAD App created before. Select the user_impersonation permission, then confirm.

 

aad-app-spo-api-custom.png

 

Finally, grant this permission by clicking on Grant admin consent for contoso.

 

If you go again in the API access page, you should see something like this:

 

api-access-custom-approved.png

 

Add custom API through CLI for Microsoft 365

 

m365 login # Don't execute that command if you're already connected
m365 spo serviceprincipal grant add --resource 'contoso-api-dp20200915' --scope 'user_impersonation'

 

Info

Don't be surprised if by that way, the permission appears in the "Other permissions granted for [your tenant]": it won't prevent your SPFx solution to work.

 

Warning

If you use an Azure Function as an API and enable Managed Identity for any reason, you better have to rename the linked AAD Application to give it a different name than both your Function and its Managed Identity. Otherwise, the command will try to find a scope on it instead of the AAD App and fail.

 

Updated sample

 

To run your custom API from your SPFx component, you can update your sample like below:

 

IHelloApiProps.ts

 

import { AadHttpClientFactory } from '@microsoft/sp-http';

export interface IHelloApiProps {
  aadFactory: AadHttpClientFactory;
  description: string;
}

 

 

HelloApiWebPart.ts

 

// ...
export default class HelloApiWebPart extends BaseClientSideWebPart<IHelloApiWebPartProps> {

    // ...

    public render(): void {
        const element: React.ReactElement<IHelloApiProps> = React.createElement(
        HelloGraph,
        {
            description: this.properties.description,
            aadFactory: this.context.aadHttpClientFactory,
        }
        );

        ReactDom.render(element, this.domElement);
    }

  // ...
}

 

 

HelloApi.tsx

 

import * as React from 'react';
import styles from './HelloApi.module.scss';
import { IHelloApiProps } from './IHelloApiProps';
import { AadHttpClient, HttpClientResponse } from '@microsoft/sp-http';

interface IHelloApiState {
  ordersToDisplay: any;
}

export default class HelloApi extends React.Component<IHelloApiProps, IHelloApiState> {

 public constructor(props) {
    super(props);

    this.state = {
    ordersToDisplay: null
    };
 }

 public componentDidMount() {
    this.props.aadFactory
      .getClient('https://contoso-api-dp20191109.azurewebsites.net')
      .then((client: AadHttpClient): void => {
        client
          .get('https://contoso-api-dp20191109.azurewebsites.net/api/Orders', AadHttpClient.configurations.v1)
          .then((response: HttpClientResponse): Promise<any> => {
            return response.json();
          })
          .then((orders: any): void => {
            this.setState({
              ordersToDisplay: orders
            })
          });
      }).catch((err) => {
        console.log(err);
      });
  }

  public render(): React.ReactElement<IHelloApiProps> {
    return (
      <div className={ styles.HelloApi }>
        <div className={ styles.container }>
          <div className={ styles.row }>
            <div className={ styles.column }>
              <span className={ styles.title }>Welcome to SharePoint!</span>
              <p className={ styles.subTitle }>Customize SharePoint experiences using Web Parts.</p>
              <p className={ styles.description }>
               <ul>
                    {this.state.ordersToDisplay &&
                        this.state.ordersToDisplay.map(o => {
                            return <li>{o.rep}: {o.total}</li>
                        })
                    }
                </ul>
              </p>
            </div>
          </div>
        </div>
      </div>
    );
  }
}

 

 

Now you can run your sample locally and try it in your hosted workbench, playing with it and updating your WebPart as you want!

 

... And don't forget to update your package-solution.json file to include the required APIs before shipping! :smile:

 

Happy coding!

 

This article was cross-posted on my blog.

%3CLINGO-SUB%20id%3D%22lingo-sub-2189059%22%20slang%3D%22en-US%22%3EInit%20API%20permissions%20for%20your%20SPFx%20projects%20without%20deploying%20them%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2189059%22%20slang%3D%22en-US%22%3E%3CP%3EWhen%20developing%20your%20SPFx%20components%2C%20you%20usually%20first%20run%20them%20locally%20before%20deploying%20them%20(really%3F).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAnd%20then%20comes%20the%20time%20to%20work%20with%20API%20such%20as%20Microsoft%20Graph.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20never%20use%20those%20permissions%20before%20in%20your%20SPFx%20projects%20(and%20the%20tenant%20with%20which%20you're%20working)%2C%20you%20realize%20that%20you%20have%20to%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EAdd%20required%20API%20permissions%20in%20your%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Epackage-solution.json%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile%3C%2FLI%3E%0A%3CLI%3EBundle%20%2F%20Ship%20your%20project%3C%2FLI%3E%0A%3CLI%3EPublish%20it%3C%2FLI%3E%0A%3CLI%3EGo%20to%20the%20SharePoint%20Admin%20Center%20Web%20API%20Permissions%20page%3C%2FLI%3E%0A%3CLI%3EApprove%20those%20permissions%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAll%20of%20this%2C%20just%20to%20play%20with%20the%20API%20as%20you%20didn't%20plan%20to%20release%20your%20package%20in%20a%20production%20environment.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESo%20what%20if%20you%20could%20bypass%20all%20these%20steps%20for%20both%20Graph%20and%20owned%20API%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CFONT%20color%3D%22%23FF9900%22%3EWarning%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%20lia-align-left%22%3E%3CSPAN%3EThis%20trick%20is%20just%20for%20development%20purposes.%20In%20Production%20environment%2C%20you%20should%20update%20your%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Epackage-solution.json%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3Bfile%20to%20add%20required%20permissions%20and%20allow%20them%20(or%20ask%20for%20validation)%20in%20the%26nbsp%3B%3C%2FSPAN%3E%3CEM%3EAPI%20access%3C%2FEM%3E%3CSPAN%3E%26nbsp%3Bpage.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--521305266%22%20id%3D%22toc-hId--521306252%22%3EPrerequisites%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EAn%20Office%20365%20(Dev)%20Tenant%20or%20a%20Partner%20Demo%20Tenant%3C%2FLI%3E%0A%3CLI%3EThe%20following%20Azure%20AD%20role%20at%20least%3CUL%3E%0A%3CLI%3EApplication%20Administrator%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1966207567%22%20id%3D%22toc-hId-1966206581%22%3EWith%20Graph%20API%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EFirst%2C%20we're%20going%20to%20play%20with%20Graph%20API%20through%20the%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Ffr-fr%2Fgraph%2Ftoolkit%2Foverview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EMicrosoft%20Graph%20Toolkit%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--1638198255%22%20id%3D%22toc-hId--1638199241%22%3EPrepare%20your%20sample%3C%2FH3%3E%0A%3CP%3EInit%20a%20SPFx%20project%20(WebPart%20one%20with%20React%2C%20let's%20call%20it%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3EHelloApi%3C%2FEM%3E)%2C%20then%20add%20the%20Microsoft%20Graph%20Toolkit%20by%20executing%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Enpm%20i%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F41501%22%20target%3D%22_blank%22%3E%40microsoft%3C%2FA%3E%2Fmgt%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F41501%22%20target%3D%22_blank%22%3E%40microsoft%3C%2FA%3E%2Fmgt-react%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efrom%20the%20project's%20root%20path.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOnce%20done%2C%20open%20your%20main%20component%20file%20(let's%20say%20here%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EHelloApi.tsx%3C%2FSTRONG%3E)%20and%20add%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EPeoplePicker%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ecomponent%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-javascript%22%3E%3CCODE%3Eimport%20*%20as%20React%20from%20'react'%3B%0Aimport%20styles%20from%20'.%2FHelloApi.module.scss'%3B%0Aimport%20%7B%20IHelloApiProps%20%7D%20from%20'.%2FIHelloApiProps'%3B%0Aimport%20%7B%20escape%20%7D%20from%20'%40microsoft%2Fsp-lodash-subset'%3B%0Aimport%20%7B%20PeoplePicker%20%7D%20from%20'%40microsoft%2Fmgt-react'%3B%0A%0Aexport%20default%20class%20HelloApi%20extends%20React.Component%3CIHELLOAPIPROPS%3E%20%7B%0A%20%20public%20render()%3A%20React.ReactElement%3CIHELLOAPIPROPS%3E%20%7B%0A%20%20%20%20return%20(%0A%20%20%20%20%20%20%3CDIV%20classname%3D%22%7B%22%20styles.helloapi%3D%22%22%3E%0A%20%20%20%20%20%20%20%20%3CDIV%20classname%3D%22%7B%22%20styles.container%3D%22%22%3E%0A%20%20%20%20%20%20%20%20%20%20%3CDIV%20classname%3D%22%7B%22%20styles.row%3D%22%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CDIV%20classname%3D%22%7B%22%20styles.column%3D%22%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20classname%3D%22%7B%22%20styles.title%3D%22%22%3EWelcome%20to%20SharePoint!%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CP%20classname%3D%22%7B%22%20styles.subtitle%3D%22%22%3ECustomize%20SharePoint%20experiences%20using%20Web%20Parts.%3C%2FP%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CP%20classname%3D%22%7B%22%20styles.description%3D%22%22%3E%7Bescape(this.props.description)%7D%3C%2FP%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CA%20href%3D%22https%3A%2F%2Faka.ms%2Fspfx%22%20classname%3D%22%7B%22%20styles.button%3D%22%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20classname%3D%22%7B%22%20styles.label%3D%22%22%3ELearn%20more%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2FA%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3C%2FDIV%3E%0A%20%20%20%20%20%20%20%20%20%20%3C%2FDIV%3E%0A%20%20%20%20%20%20%20%20%3C%2FDIV%3E%0A%20%20%20%20%20%20%20%20%3CPEOPLEPICKER%3E%3C%2FPEOPLEPICKER%3E%0A%20%20%20%20%20%20%3C%2FDIV%3E%0A%20%20%20%20)%3B%0A%20%20%7D%0A%7D%3C%2FIHELLOAPIPROPS%3E%3C%2FIHELLOAPIPROPS%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-849314578%22%20id%3D%22toc-hId-849313592%22%3ERun%20it%20in%20remote%20workbench%3C%2FH3%3E%0A%3CP%3ENow%20run%20your%20sample%20with%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Egulp%20serve%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20display%20your%20webpart%20in%20your%20remote%20workbench%20(%3CA%20href%3D%22https%3A%2F%2Fcontoso.sharepoint.com%2F_layouts%2F15%2Fworkbench.aspx%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fcontoso.sharepoint.com%2F_layouts%2F15%2Fworkbench.aspx%3C%2FA%3E).%20Try%20to%20use%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EPeoplePicker%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ecomponent%3A%20you'll%20see%20that%20just%20by%20clicking%20on%20the%20search%20box%2C%20you'll%20get%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3EWe%20didn't%20find%20any%20matches%3C%2FEM%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22peoplepicker-ui-fail.png%22%20style%3D%22width%3A%20804px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F261327i7C491A73DF1A9A84%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22peoplepicker-ui-fail.png%22%20alt%3D%22peoplepicker-ui-fail.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDisplay%20your%20developer%20toolbox%20(F12)%20and%20go%20to%20the%20browser%20console%2C%20you%20should%20see%20the%20following%20error%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22peoplepicker-console-fail.png%22%20style%3D%22width%3A%20972px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F261328i877C183AB94DAEC5%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22peoplepicker-console-fail.png%22%20alt%3D%22peoplepicker-console-fail.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20you%20can%20see%2C%20it's%20a%20403%20error%2C%20which%20is%20well-known%20when%20using%20Graph%20API%20endpoints%20that%20have%20not%20been%20allowed%20on%20the%20first%20place.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--958139885%22%20id%3D%22toc-hId--958140871%22%3EAdd%20Graph%20API%20through%20UI%3C%2FH3%3E%0A%3CP%3EFrom%20the%20Azure%20portal%2C%20display%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3EAzure%20Active%20Directory%3C%2FEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E(AAD)%2C%20then%20select%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EApp%20Registration%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Emenu%20and%20select%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAll%20Applications%3C%2FSTRONG%3E%2C%20then%20click%20on%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ESharePoint%20Online%20Client%20Extensibility%20Web%20Application%20Principal%3C%2FSTRONG%3E.%20It's%20the%20AAD%20Application%20that%20holds%20the%20connection%20to%20the%20API%20(Microsoft%20and%20others)%20from%20SharePoint%20(SPFx%20or%20every%20other%20development)%20using%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3EImplicit%20Flow%3C%2FEM%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOnce%20here%2C%20click%20on%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAdd%20a%20permission%3C%2FSTRONG%3E%2C%20then%20select%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EMicrosoft%20Graph%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20add%20the%20%5B%3CEM%3EPeople.Read%3C%2FEM%3E%5D%20Graph%20API%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CINS%3Edelegated%20permission%3C%2FINS%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E(you%20can%20type%20the%20name%20of%20the%20permission%20in%20the%20available%20search%20box%20to%20get%20it%20easily).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22aad-app-spo-api-graph.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F261329i49E61D0AD724669F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22aad-app-spo-api-graph.png%22%20alt%3D%22aad-app-spo-api-graph.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOnce%20added%2C%20grant%20it%20by%20clicking%20on%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EGrant%20admin%20consent%20for%20contoso%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20go%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3EAPI%20access%3C%2FEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Epage%20(%3CA%20href%3D%22https%3A%2F%2Fcontoso-admin.sharepoint.com%2F_layouts%2F15%2Fonline%2FAdminHome.aspx%23%2FwebApiPermissionManagement%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fcontoso-admin.sharepoint.com%2F_layouts%2F15%2Fonline%2FAdminHome.aspx%23%2FwebApiPermissionManagement%3C%2FA%3E)%2C%20you%20should%20see%20something%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22api-access-approved.png%22%20style%3D%22width%3A%20977px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F261330i6A95D15054FE0812%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22api-access-approved.png%22%20alt%3D%22(other%20Graph%20API%20permissions%20displayed%20here%20won't%20be%20necessary%20for%20the%20sample)%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3E(other%20Graph%20API%20permissions%20displayed%20here%20won't%20be%20necessary%20for%20the%20sample)%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSTRONG%3E%3CFONT%20color%3D%22%23FF9900%22%3EWarning%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-align-left%20lia-indent-padding-left-30px%22%3E%3CSPAN%3EIt%20can%20take%20a%20couple%20of%20minutes%20before%20consented%20permissions%20is%20effective%2C%20so%20don't%20be%20surprised%20if%20it's%20not%20working%20right%20away%20after%20approval.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1529372948%22%20id%3D%22toc-hId-1529371962%22%3EAdd%20Graph%20API%20through%20CLI%20for%20Microsoft%20365%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Em365%20login%20%23%20Don't%20execute%20that%20command%20if%20you're%20already%20connected%0Am365%20spo%20serviceprincipal%20grant%20add%20--resource%20'Microsoft%20Graph'%20--scope%20'People.Read'%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CFONT%20color%3D%22%2300CCFF%22%3EInfo%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-align-left%20lia-indent-padding-left-30px%22%3E%3CSPAN%3EDon't%20be%20surprised%20if%20by%20that%20way%2C%20the%20permission%20appears%20in%20the%20%22Other%20permissions%20granted%20for%20%5Byour%20tenant%5D%22%3A%20it%20won't%20prevent%20your%20SPFx%20solution%20to%20work.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--278081515%22%20id%3D%22toc-hId--278082501%22%3ETry%20again%3C%2FH3%3E%0A%3CP%3ENow%20try%20to%20use%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EPeoplePicker%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ecomponent%20again%3A%20you'll%20see%20that%20with%20the%20addition%20of%20the%20Graph%20API%20permission%2C%20you%20should%20be%20able%20to%20use%20that%20component!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22peoplepicker-ui-success.png%22%20style%3D%22width%3A%20799px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F261331i81A858A6A4D017BA%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22peoplepicker-ui-success.png%22%20alt%3D%22peoplepicker-ui-success.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--288584619%22%20id%3D%22toc-hId--288585605%22%3EWith%20custom%20API%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20using%20a%20custom%20API%2C%20it's%20a%20little%20bit%20more%20tricky%20but%20easy%20to%20handle%20anyway.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20follow%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Ffr-fr%2Fsharepoint%2Fdev%2Fspfx%2Fuse-aadhttpclient-enterpriseapi%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ethis%20Microsoft%20article%3C%2FA%3E%26nbsp%3Buntil%20the%3CSPAN%3E%26nbsp%3B%22%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fspfx%2Fuse-aadhttpclient-enterpriseapi%23deploy-the-solution-to-the-sharepoint-app-catalog%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EDeploy%20the%20solution%3C%2FA%3E%22%20part.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EInstead%20of%20bundling%20and%20shipping%2C%20we'll%20add%20the%20AAD%20App%20(called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3Econtoso-api-dp20200915%3C%2FEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eif%20we%20follow%20the%20mentioned%20article)%20created%20from%20the%20Azure%20Function%20Authentication%20part%20in%20the%20SharePoint%20Service%20Principal.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-401976855%22%20id%3D%22toc-hId-401975869%22%3EAdd%20your%20AAD%20Application%20to%20the%20SharePoint%20Service%20Principal%3C%2FH3%3E%0A%3CP%3E%3CSPAN%3EDisplay%20again%20the%20AAD%20page%2C%20then%20select%20the%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EApp%20Registration%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3Bmenu%2C%20select%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAll%20Applications%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3Band%20click%20on%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ESharePoint%20Online%20Client%20Extensibility%20Web%20Application%20Principal%3C%2FSTRONG%3E%3CSPAN%3E.%20Once%20here%2C%20click%20on%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAdd%20a%20permission%3C%2FSTRONG%3E%3CSPAN%3E%2C%20then%20select%20the%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EMy%20APIs%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3Btab%20and%20select%20the%20fresh%20added%20AAD%20App%20created%20before.%20Select%20the%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Euser_impersonation%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3Bpermission%2C%20then%20confirm.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22aad-app-spo-api-custom.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F261332i7206CD2A49DCAEFB%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22aad-app-spo-api-custom.png%22%20alt%3D%22aad-app-spo-api-custom.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFinally%2C%20grant%20this%20permission%20by%20clicking%20on%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EGrant%20admin%20consent%20for%20contoso%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20go%20again%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3EAPI%20access%3C%2FEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Epage%2C%20you%20should%20see%20something%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22api-access-custom-approved.png%22%20style%3D%22width%3A%20967px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F261337i4486CDC42E9CFA65%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22api-access-custom-approved.png%22%20alt%3D%22api-access-custom-approved.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--1405477608%22%20id%3D%22toc-hId--1405478594%22%3EAdd%20custom%20API%20through%20CLI%20for%20Microsoft%20365%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-javascript%22%3E%3CCODE%3Em365%20login%20%23%20Don't%20execute%20that%20command%20if%20you're%20already%20connected%0Am365%20spo%20serviceprincipal%20grant%20add%20--resource%20'contoso-api-dp20200915'%20--scope%20'user_impersonation'%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CFONT%20color%3D%22%2300CCFF%22%3EInfo%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%20lia-align-left%22%3E%3CSPAN%3EDon't%20be%20surprised%20if%20by%20that%20way%2C%20the%20permission%20appears%20in%20the%20%22Other%20permissions%20granted%20for%20%5Byour%20tenant%5D%22%3A%20it%20won't%20prevent%20your%20SPFx%20solution%20to%20work.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-align-left%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSTRONG%3E%3CFONT%20color%3D%22%23FF9900%22%3EWarning%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%20lia-align-left%22%3E%3CSPAN%3EIf%20you%20use%20an%20Azure%20Function%20as%20an%20API%20and%20enable%26nbsp%3B%3CSTRONG%3EManaged%20Identity%3C%2FSTRONG%3E%26nbsp%3Bfor%20any%20reason%2C%20you%20better%20have%20to%20rename%20the%20linked%20AAD%20Application%20to%20give%20it%20a%20different%20name%20than%20both%20your%20Function%20and%20its%26nbsp%3B%3CSTRONG%3EManaged%20Identity%3C%2FSTRONG%3E.%20Otherwise%2C%20the%20command%20will%20try%20to%20find%20a%20scope%20on%20it%20instead%20of%20the%20AAD%20App%20and%20fail.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-386871746%22%20id%3D%22toc-hId-386870760%22%3EUpdated%20sample%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20run%20your%20custom%20API%20from%20your%20SPFx%20component%2C%20you%20can%20update%20your%20sample%20like%20below%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CEM%3EIHelloApiProps.ts%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-javascript%22%3E%3CCODE%3Eimport%20%7B%20AadHttpClientFactory%20%7D%20from%20'%40microsoft%2Fsp-http'%3B%0A%0Aexport%20interface%20IHelloApiProps%20%7B%0A%20%20aadFactory%3A%20AadHttpClientFactory%3B%0A%20%20description%3A%20string%3B%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CEM%3EHelloApiWebPart.ts%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-javascript%22%3E%3CCODE%3E%2F%2F%20...%0Aexport%20default%20class%20HelloApiWebPart%20extends%20BaseClientSideWebPart%3CIHELLOAPIWEBPARTPROPS%3E%20%7B%0A%0A%20%20%20%20%2F%2F%20...%0A%0A%20%20%20%20public%20render()%3A%20void%20%7B%0A%20%20%20%20%20%20%20%20const%20element%3A%20React.ReactElement%3CIHELLOAPIPROPS%3E%20%3D%20React.createElement(%0A%20%20%20%20%20%20%20%20HelloGraph%2C%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20description%3A%20this.properties.description%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20aadFactory%3A%20this.context.aadHttpClientFactory%2C%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20)%3B%0A%0A%20%20%20%20%20%20%20%20ReactDom.render(element%2C%20this.domElement)%3B%0A%20%20%20%20%7D%0A%0A%20%20%2F%2F%20...%0A%7D%3C%2FIHELLOAPIPROPS%3E%3C%2FIHELLOAPIWEBPARTPROPS%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CEM%3EHelloApi.tsx%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-javascript%22%3E%3CCODE%3Eimport%20*%20as%20React%20from%20'react'%3B%0Aimport%20styles%20from%20'.%2FHelloApi.module.scss'%3B%0Aimport%20%7B%20IHelloApiProps%20%7D%20from%20'.%2FIHelloApiProps'%3B%0Aimport%20%7B%20AadHttpClient%2C%20HttpClientResponse%20%7D%20from%20'%40microsoft%2Fsp-http'%3B%0A%0Ainterface%20IHelloApiState%20%7B%0A%20%20ordersToDisplay%3A%20any%3B%0A%7D%0A%0Aexport%20default%20class%20HelloApi%20extends%20React.Component%3CIHELLOAPIPROPS%3E%20%7B%0A%0A%20public%20constructor(props)%20%7B%0A%20%20%20%20super(props)%3B%0A%0A%20%20%20%20this.state%20%3D%20%7B%0A%20%20%20%20ordersToDisplay%3A%20null%0A%20%20%20%20%7D%3B%0A%20%7D%0A%0A%20public%20componentDidMount()%20%7B%0A%20%20%20%20this.props.aadFactory%0A%20%20%20%20%20%20.getClient('https%3A%2F%2Fcontoso-api-dp20191109.azurewebsites.net')%0A%20%20%20%20%20%20.then((client%3A%20AadHttpClient)%3A%20void%20%3D%26gt%3B%20%7B%0A%20%20%20%20%20%20%20%20client%0A%20%20%20%20%20%20%20%20%20%20.get('https%3A%2F%2Fcontoso-api-dp20191109.azurewebsites.net%2Fapi%2FOrders'%2C%20AadHttpClient.configurations.v1)%0A%20%20%20%20%20%20%20%20%20%20.then((response%3A%20HttpClientResponse)%3A%20Promise%3CANY%3E%20%3D%26gt%3B%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20response.json()%3B%0A%20%20%20%20%20%20%20%20%20%20%7D)%0A%20%20%20%20%20%20%20%20%20%20.then((orders%3A%20any)%3A%20void%20%3D%26gt%3B%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20this.setState(%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20ordersToDisplay%3A%20orders%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D)%0A%20%20%20%20%20%20%20%20%20%20%7D)%3B%0A%20%20%20%20%20%20%7D).catch((err)%20%3D%26gt%3B%20%7B%0A%20%20%20%20%20%20%20%20console.log(err)%3B%0A%20%20%20%20%20%20%7D)%3B%0A%20%20%7D%0A%0A%20%20public%20render()%3A%20React.ReactElement%3CIHELLOAPIPROPS%3E%20%7B%0A%20%20%20%20return%20(%0A%20%20%20%20%20%20%3CDIV%20classname%3D%22%7B%22%20styles.helloapi%3D%22%22%3E%0A%20%20%20%20%20%20%20%20%3CDIV%20classname%3D%22%7B%22%20styles.container%3D%22%22%3E%0A%20%20%20%20%20%20%20%20%20%20%3CDIV%20classname%3D%22%7B%22%20styles.row%3D%22%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CDIV%20classname%3D%22%7B%22%20styles.column%3D%22%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20classname%3D%22%7B%22%20styles.title%3D%22%22%3EWelcome%20to%20SharePoint!%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CP%20classname%3D%22%7B%22%20styles.subtitle%3D%22%22%3ECustomize%20SharePoint%20experiences%20using%20Web%20Parts.%3C%2FP%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CP%20classname%3D%22%7B%22%20styles.description%3D%22%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CUL%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Bthis.state.ordersToDisplay%20%26amp%3B%26amp%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20this.state.ordersToDisplay.map(o%20%3D%26gt%3B%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20return%20%3CLI%3E%7Bo.rep%7D%3A%20%7Bo.total%7D%3C%2FLI%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2FUL%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2FP%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3C%2FDIV%3E%0A%20%20%20%20%20%20%20%20%20%20%3C%2FDIV%3E%0A%20%20%20%20%20%20%20%20%3C%2FDIV%3E%0A%20%20%20%20%20%20%3C%2FDIV%3E%0A%20%20%20%20)%3B%0A%20%20%7D%0A%7D%3C%2FIHELLOAPIPROPS%3E%3C%2FANY%3E%3C%2FIHELLOAPIPROPS%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20you%20can%20run%20your%20sample%20locally%20and%20try%20it%20in%20your%20hosted%20workbench%2C%20playing%20with%20it%20and%20updating%20your%20WebPart%20as%20you%20want!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E...%20And%20don't%20forget%20to%20update%20your%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Epackage-solution.json%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile%20to%20include%20the%20required%20APIs%20before%20shipping!%3CSPAN%3E%26nbsp%3B%3CIMG%20class%3D%22lia-deferred-image%20lia-image-emoji%22%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Fhtml%2F%408341BD79091AF36AA2A09063B554B5CD%2Fimages%2Femoticons%2Fsmile_40x40.gif%22%20alt%3D%22%3Asmile%3A%22%20title%3D%22%3Asmile%3A%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHappy%20coding!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CEM%3EThis%20article%20was%20cross-posted%20on%20%3CA%20href%3D%22https%3A%2F%2Fmichaelmaillot.github.io%2Ftips%2F20210302-spfx-api-permissions%2F%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Emy%20blog%3C%2FA%3E.%3C%2FEM%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-2189059%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%227717470502_7afc3ff548_b.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F262362i9A5335DB9EE2853B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%227717470502_7afc3ff548_b.jpg%22%20alt%3D%227717470502_7afc3ff548_b.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20developing%20your%20SPFx%20components%2C%20you%20usually%20first%20run%20them%20locally%20before%20deploying%20them%20(really%3F).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAnd%20then%20comes%20the%20time%20to%20work%20with%20API%20such%20as%20Microsoft%20Graph.%3C%2FP%3E%3C%2FLINGO-TEASER%3E
Co-Authors
Version history
Last update:
‎Mar 10 2021 01:18 AM
Updated by: