I tried using context.pageContext.legacyPageContext.guestsEnabled, but it returns false when external sharing on the site is set to "Existing guests only" and works fine for "New and Existing Guests".

enter image description here

Is there any other way to know if guest access is enabled on the site in SPFx?

1 Answer 1


This is a known issue of legacyPageContext object.

Also, I would like to highlight another point that, this property "this.context.pageContext.legacyPageContext.guestsEnabled" returns FALSE when we choose Existing Guests only Option in Admin for external sharing.

However, if I choose the New and Existing Guests option it returns TRUE, I was expecting TRUE for both the selections.

Source: Identifying External Sharing in Site Collections using SPFx

  • Hi Mohammad, Please Upvote(^) and accept as an Answer if it helped you in any way & it will help others with similar question in future to find the correct answer easily. It also removes this question from "Unanswered questions" list. Commented Sep 2, 2021 at 16:13

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.