I am not finding the right XML schema to include it in my PNP provisioning template.

How can I include settings called "New and existing guests" for external sharing while provisioning a site using pnp provisioning template?

I am not sure where to add exactly here? I also heard that we can include documents in PNP provisioning template, but I am getting error as an invalid template if I include that.

<pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2020/02/ProvisioningSchema">
  <pnp:Preferences Generator="OfficeDevPnP.Core, Version=3.18.2002.0, Culture=neutral, PublicKeyToken=5e633289e95c321a" />
  <pnp:Templates ID="CONTAINER-TEMPLATE-1AFCA687C58D4033A2FEC5FDA9F29256">
    <pnp:ProvisioningTemplate ID="TEMPLATE-1AFCA687C58D4033A2FEC5FDA9F29256" Version="1" BaseSiteTemplate="GROUP#0" Scope="RootSite">
      <pnp:WebSettings RequestAccessEmail="" NoCrawl="false" WelcomePage="SitePages/Home.aspx" SiteLogo="{site}/_api/GroupService/GetGroupImage?id='303de100-57ea-4199-b48f-34ddb222df78'&amp;hash=637170283721262427" AlternateCSS="" MasterPageUrl="{masterpagecatalog}/seattle.master" CustomMasterPageUrl="{masterpagecatalog}/seattle.master" HubSiteUrl="https://m365x539190.sharepoint.com/sites/ourclients" CommentsOnSitePagesDisabled="false" QuickLaunchEnabled="true" MembersCanShare="true" SearchScope="DefaultScope" SearchBoxInNavBar="Inherit" />
      <pnp:SiteSettings AllowDesigner="true" AllowCreateDeclarativeWorkflow="true" AllowSaveDeclarativeWorkflowAsTemplate="true" AllowSavePublishDeclarativeWorkflow="true" SearchBoxInNavBar="Inherit" SearchCenterUrl="" />
      <pnp:RegionalSettings AdjustHijriDays="0" AlternateCalendarType="None" CalendarType="Gregorian" Collation="25" FirstDayOfWeek="Sunday" FirstWeekOfYear="0" LocaleId="1033" ShowWeeks="false" Time24="false" TimeZone="13" WorkDayEndHour="5:00PM" WorkDays="62" WorkDayStartHour="8:00AM" />

1 Answer 1


You cannot do this at a site level currently (it's not included in the current schema)

I currently set the value in my PS script before I call the Apply-PnPProvisioningTemplate e.g.

Connect-SPOService -Url $adminSiteUrl -Credential $creds
Set-SPOSite -Identity $siteUrl -SharingCapability Disabled
Get-SPOSite -Identity $siteUrl | select Url, SharingCapability

Where the possible values for SharingCapability are:

Disabled - don't allow sharing outside your organization,

ExistingExternalUserSharingOnly - Allow sharing only with the external users that already exist in your organization's directory,

ExternalUserSharingOnly - allow external users who accept sharing invitations and sign in as authenticated users, or

ExternalUserAndGuestSharing - allow sharing with all external users, and by using anonymous access links.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.