0

As stated above in the title I am currently facing issues fetching graph places with PnPJs, using the @pnp/graph graphfi factory interface in SPFx.

I am currently able to fetch data from my events via graphfi as can be seen below:

React.useEffect(() => {
    graph = graphfi().using(SPFx(props.context));
    getSpecificCalendar();
}, []);

const getSpecificCalendar = async () => {
    await graph.me.events().then((e) => setCalendarEvent(e));
} 

I have tried to get the places property from the graph object but to no avail. The only properties present are me and users but no option for places. Esentially what I want to do is to graph.places. The conclusion I have come to is that @pnp/graph does not have any methods to get room data. Any ideas other than what I have tried above would be extremely helpful.

1 Answers1

0

It looks like pnpjs does not have the /places endpoint implemented (yet). You could try using the built-in SPFx graph client for now. Something like:

const client = await props.context.msGraphClientFactory.getClient('3')
const response = await client.api('/places/......').get();

Alternatively, you could implement the /places endpoint yourself and submit a pull request for pnpjs :)

Nikolay
  • 10,752
  • 2
  • 23
  • 51
  • Could you clarify what you mean by "implement endpoint yourself and a pull request for pnpjs"? – liondepierre Nov 16 '22 at 07:23
  • I mean PNPJS library is open source, you can clone it, create the endpoint for `/places` similar to other endpoints, and submit a pull request. Example for `/sites` https://github.com/pnp/pnpjs/tree/version-3/packages/graph/sites In short: fix the library and add the missing feature yourself. Then share you work with others. – Nikolay Nov 16 '22 at 09:28