简体   繁体   中英

How to check which page is the aspx homepage in SP Online with React Spfx

If I am on a site collection and the homepage isn't "Home.aspx", how can I check which one is it using react SPFX framework?

You could use pnp library to get the welcome page.

pnp.sp.web.get().then(web=>{
      console.log(web.WelcomPage);
    })

https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/guidance/use-sp-pnp-js-with-spfx-web-parts

This combination worked for me:

pnp.setup({
  spfxContext: this.props.context
});
let welcomePage = await pnp.sp.web.get().then(web=>{
  return web.WelcomePage;
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM