Home > CMS- Content Management System > Sharepoint > How to check External Sharing On or Off for a Site Collection using JavaScript or Client side object model?

How to check External Sharing On or Off for a Site Collection using JavaScript or Client side object model?

To check External Sharing On or Off for a Site Collection we will use _spPageContextInfo object.

 _spPageContextInfo is a global object. It belongs to any pages like site page, wiki, publishing and system pages. It provides us lots of useful information about the web site.

Like

_spPageContextInfo.userId – it gives us a current user id.

_spPageContextInfo.guestsEnabled – It gives us a boolean value for Site Collection external sharing on or off. True means external sharing on. False: means external sharing off.

_spPageContextInfo.isExternalGuestUser – it gives us current user external user or internal user. External user means outside of the current organization.

We cross-check Site Sharing by accessing the Admin Sharing panel, for this we need admin access permission.

References: 

This Article is TAGGED in , , , , . BOOKMARK THE permalink.

2 thoughts on “How to check External Sharing On or Off for a Site Collection using JavaScript or Client side object model?

    1. Hello Karishma, In modern view you have to use SpFx and you still add JS in classic SharePoint version using page layout/script editor/site pages, etc. See our other articles for more info.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">