How to fetch Home page in search query in spfx?

Premita-8819 6 Reputation points
2022-01-18T10:25:00.01+00:00

How to fetch Home page in search query in spfx?

Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft Security | Microsoft Graph

2 answers

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,501 Reputation points Microsoft External Staff
    2022-01-19T06:55:36.977+00:00

    Hi @Premita-8819 ,
    Per my research, I will agree with sadomovalex's opinion. You can use Rest Api to fetch Home page. If you want to get it by search query. I will recommend you to raise a feedback here.
    Many features of our current products are designed and upgraded based on customers’ feedback. With requirements like this increase, the problem may well be released in the future. Thanks for your understanding.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    Was this answer helpful?


  2. sadomovalex 3,636 Reputation points
    2022-01-18T15:09:41.973+00:00

    if you just need to redirect user to this page then you may get site's url from search and redirect there -> Sharepoint will redirect to home page automatically. If you need to get home page url then I'm not sure it is possible via Search. But it is possible via REST API which also can be used in SPFx e.g. like shown here: How to check if current page is the default page of the current site using jsom or REST:

    _api/Web/RootFolder/WelcomePage

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.