Domanda

I'm developing a SharePoint extension (ListViewCommandSet extension).

I have no clue (can't find any docs about this) how to give permissions to access Graph API (even the /me call gives a 403 response).

Any ideas of how to access the Graph API from localhost when developing a SPFX extension?

È stato utile?

Soluzione

The Leverage the Microsoft Graph & 3rd Party APIs training module shows how to configure your project to use the Microsoft Graph. The training module shows how to do so in a web part project, but the same process can be used when building a SharePoint Framework extension.

SharePoint Framework projects that call to the Microsoft Graph cannot be tested or debugged in the local workbench. They can be tested and debugged in the hosted workbench, but only after the requested permissions have been granted in the SharePoint Online Admin Center.

Altri suggerimenti

Do you use PnPjs, if so, which version?

Microsoft Graph API is accessible with PnPjs. You have to install the following packages with npm :

npm install @pnp/logging @pnp/common @pnp/odata @pnp/graph --save

This guide details this part.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top