Skip to content

Identifying External Sharing in Site Collections using SPFx #5250

@NavaneethaDev

Description

@NavaneethaDev

Category

  • Bug

Describe the bug

I am currently using "this.context.pageContext.legacyPageContext.guestsEnabled" property to identify if the site collection is shared externally or not.
However, when i look at this link https://docs.microsoft.com/en-us/javascript/api/sp-page-context/pagecontext?view=sp-typescript-latest#legacypagecontext. It says that this property is legacy and are encouraged to use the SharePoint Framework TypeScript APIs instead.

I am not able to find a relevant SharePoint Framework TypeScript API to identify the external sharing on site collections so i am submitting in GItHub as per the below Note.

"NOTE: If certain functionality is exposed in the legacyPageContext but does not seem to have a proper TypeScript API, please file an issue on GitHub. The intention is that no modern application should need to rely on the legacyPageContext object."

If there is a relevant SharePoint Framework TypeScript API to achieve this, please share.

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 (Attached the below screenshot). However, if i choose the New and Existing Guests option it returns "True", I was expecting "True" for both the selections.
image

Which property we need to use which returns True for the above selection.

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:csom/rest/apiCategory: SharePoint Client Side Object Model SDK / REST APIarea:spfxCategory: SharePoint Framework (not extensions related)status:answeredAnswer to a question.type:questionQuestion... if answered, will be tagged as such.type:uservoice-requestEnhancements & feature requests should be posted: http://aka.ms/sp-dev-uservoice

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions