Closed cardinalpipkin closed 3 months ago
I am guessing that your context is undefined which would be easy to determine by debugging.
Yes - that was it. I hadn't added the context correctly. Thank you as ever.
protected async onInit(): Promise<void> {
super.onInit();
//Initialize our _sp object that we can then use in other packages without having to pass around the context.
// Check out pnpjsConfig.ts for an example of a project setup file.
getSP(this.context);
getGraph(this.context); <----I hadn't added this....
}
This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked.
What version of PnPjs library you are using
3.x
Minor Version Number
24.0
Target environment
SharePoint Framework
Additional environment details
Have checked that all WebParts have the required permissions within admin
Question/Request
I'm attempting to get the Id of an SPO Hub site by using both getById and getByUrl:
and I'm getting the same error for both attempts above.
I'm using the config file to get context:
The getSP works as expected but not getGraph. Am I missing something obvious here?