1

I am trying to use pnp.sp.web.hubSiteData on my SPFX code, my problem is that hubSiteData property is not showing or coming up I have installed pnpjs to my solution by running npm install sp-pnp-js --save. is there other library that I need to add or import?

enter image description here

2
  • 1
    you want to get the hubsiteid for the site ? Because pnp.sp.web.hubsitedata is a method and not a property Commented Apr 14, 2020 at 15:08
  • 1
    sorry about that Gautam Sheth, I am new to SPFX.. hehe.. basically I just want to be able to use hubsitedata to get a list of site associated to a hub site. same here pnp.github.io/pnpjs/sp/webs/#hubsitedata
    – SP_Elms
    Commented Apr 14, 2020 at 15:11

1 Answer 1

0

The reason that web.hubSiteData() method does not show up is that there is a missing @pnp/sp/hubsites import:

import { IHubSiteWebData } from "@pnp/sp/hubsites";

Once you add this import to the script file, the autocomplete for the hubSiteData() should start working.

1
  • Thanks @DenisMolodtsov
    – SP_Elms
    Commented Apr 15, 2020 at 9:05

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.