3

I have an SPFX solution where I am trying to use Graph API. I tried installing 'npm install @pnp/logging @pnp/core @pnp/queryable @pnp/graph --save'

Now, while using 'import { graph } from "@pnp/graph"' I am getting below error.

'"@pnp/graph"' has no exported member named 'graph'.

Please guide me if anything I am missing here..

1 Answer 1

3

The use of graph was changed to graphfi in PnPjs v3.

enter image description here

https://pnp.github.io/pnpjs/transition-guide/#global-vs-instance-architecture

Here's a simple example of the use of graphfi from the PnPjs documentation.

import { SPFx, graphfi } from "@pnp/graph";
import "@pnp/graph/users";

// within a webpart, application customizer, or adaptive card extension where the context object is available
const graph = graphfi().using(SPFx(this.context));

const meData = await graph.me();

https://pnp.github.io/pnpjs/concepts/authentication/#spfx-graph

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.