SOLVED

Home.aspx content and webparts when extracting PnP site provisioning schema?

%3CLINGO-SUB%20id%3D%22lingo-sub-26074%22%20slang%3D%22en-US%22%3EHome.aspx%20content%20and%20webparts%20when%20extracting%20PnP%20site%20provisioning%20schema%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-26074%22%20slang%3D%22en-US%22%3E%3CP%3EShould%20I%20be%20able%20to%20get%20the%20page%20content%20of%20the%20site%20welcome%20page%20(e.g.%20%2FSitePages%2FHome.aspx)%20and%20its%20webparts%20using%20Get-SPOProvisioningTemplate%20(PowerShell)%20or%20GetProvisioningTemplate%20(C%23)%3F%20I%20would%20think%20welcome%20page%20content%20and%20webpart%20extraction%20this%20is%20included%20in%20the%20core%20implementation%20as%20that%20is%20normally%20needed%20when%20extracting%20site%20schema.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHow%20do%20I%20extract%20the%20SitePages%2FHome.aspx%20content%20with%20webparts%3F%20Do%20I%20need%20to%20implement%20an%20extensibility%20provider%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-277819%22%20slang%3D%22en-US%22%3ERe%3A%20Home.aspx%20content%20and%20webparts%20when%20extracting%20PnP%20site%20provisioning%20schema%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-277819%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20the%20same%20issue%20and%20can%20only%20connect%20to%20sitecollections%20by%20the%20parameter%20-UseWeblogin%20because%20we%20are%20using%20ADFS%20and%20WMA.%20Please%20fix%20this%20or%20give%20me%20some%20workaround.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-39272%22%20slang%3D%22en-US%22%3ERe%3A%20Home.aspx%20content%20and%20webparts%20when%20extracting%20PnP%20site%20provisioning%20schema%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-39272%22%20slang%3D%22en-US%22%3E%3CP%3EA%20little%20update%20from%20the%20PnP%20Core%20Team%3A%20I%20just%20changed%20the%20behaviour%20of%20the%20PageContents%20handler%20(which%20is%20the%20handler%20that%20extracts%20the%20homepage).%20It%20was%20checking%20for%20the%20presence%20of%20Credentials%20on%20the%20ClientContext%20and%20if%20not%20present%20it%20would%20not%20execute%20the%20extraction%20of%20artifacts.%20That%20check%20is%20still%20valid%20for%20On-Premises%2C%20due%20to%20the%20fact%20that%20we%20have%20to%20call%20a%20webservice%20to%20work%20around%20CSOM%20limitations%2C%20but%20is%20not%20needed%20anymore%20for%20SPO%20as%20that%20version%20of%20CSOM%20allows%20us%20to%20export%20all%20webparts.%20I%20now%20made%20that%20check%20conditional%20based%20upon%20the%20version%20of%20the%20NuGet%20package%20you're%20running%2C%20and%20it%20will%20be%20available%20in%20version%202.12.1702.0%20(the%20February%202017%20release).%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-27224%22%20slang%3D%22en-US%22%3ERe%3A%20Home.aspx%20content%20and%20webparts%20when%20extracting%20PnP%20site%20provisioning%20schema%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-27224%22%20slang%3D%22en-US%22%3E%3CP%3EContinues%20as%20an%20reported%20issue%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FOfficeDev%2FPnP-Sites-Core%2Fissues%2F838%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2FOfficeDev%2FPnP-Sites-Core%2Fissues%2F838%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-26205%22%20slang%3D%22en-US%22%3ERe%3A%20Home.aspx%20content%20and%20webparts%20when%20extracting%20PnP%20site%20provisioning%20schema%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-26205%22%20slang%3D%22en-US%22%3E%3CP%3ESame%20issue%2Ffeature%20exists%20in%26nbsp%3BSharePointPnPPowerShell%3CSTRONG%3E2013%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%24creds%20%3D%20Get-Credential%0AConnect-SPOnline%20-Url%20https%3A%2F%2Fyouronprem%2Fsites%2Ftemplate%20-Credential%20%24creds%0AGet-SPOProvisioningTemplate%20-Out%20.%5Conprem-template-creds.xml%0A%0AConnect-SPOnline%20-Url%20https%3A%2F%2Fyouronprem%2Fsites%2Ftemplate%20-CurrentCredentials%0AGet-SPOProvisioningTemplate%20-Out%20.%5Conprem-template-currentcreds.xml%3C%2FPRE%3E%3CP%3EUsing%20-%3CSTRONG%3ECredential%3C%2FSTRONG%3E%20produces%20XML%20schema%20%3CSTRONG%3EWITH%3C%2FSTRONG%3E%20the%20%3CSTRONG%3Epage%3C%2FSTRONG%3E%20content%20and%20webparts%3C%2FP%3E%3CP%3EUsing%20-%3CSTRONG%3ECurrentCredentials%3C%2FSTRONG%3E%20produces%20XML%20schema%20%3CSTRONG%3EWITHOUT%3C%2FSTRONG%3E%20the%20page%20content%20and%20webparts.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-26203%22%20slang%3D%22en-US%22%3ERe%3A%20Home.aspx%20content%20and%20webparts%20when%20extracting%20PnP%20site%20provisioning%20schema%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-26203%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F2387%22%20target%3D%22_blank%22%3E%40Pieter%20Veenstra%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGreat%20suggestion.%20This%20issue%20is%20somehow%20related%20to%20the%20login%20method.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20execute%20the%20following%20PowerShell%20lines.%20Note!%20The%26nbsp%3BSharePointPnPPowerShellOnline%5C%20is%20there%20because%20of%20same%20names%20of%20the%20diefferent%20SharePointPnPPowerShell*%20modules%20have%20same%20cmdlet's%20with%20the%20same%20name%20('clobber').%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%24site%20%20%20%3D%20%22https%3A%2F%2Fmytenant.sharepoint.com%2Fsites%2Fpasi-test-template%22%0A%0ASharePointPnPPowerShellOnline%5CSet-SPOTraceLog%20-On%20-Level%20Debug%20-LogFile%20.%5Cmytemplate-creds.log%3CBR%20%2F%3E%23%0A%23%20Log%20in%20using%20network%20credentials%20-%20requires%20%3CTENANT%3E.onmicrosoft.com%20account%3CBR%20%2F%3E%23%3CBR%20%2F%3E%24Creds%20%3D%20Get-Credential%0ASharePointPnPPowerShellOnline%5CConnect-SPOnline%20-Url%20%24site%20-Credential%20%24Creds%0ASharePointPnPPowerShellOnline%5CGet-SPOProvisioningTemplate%20-Force%20-Out%20.%5Cmytemplate-creds.xml%0ASharePointPnPPowerShellOnline%5CSet-SPOTraceLog%20-Off%0A%0ASharePointPnPPowerShellOnline%5CSet-SPOTraceLog%20-On%20-Level%20Debug%20-LogFile%20.%5Cmytemplate-weblogin.log%0A%23%3CBR%20%2F%3E%23%20Log%20in%20using%20Web%20Login%20-%20you%20can%20use%20any%20valid%20accout%3CBR%20%2F%3E%23%0ASharePointPnPPowerShellOnline%5CConnect-SPOnline%20-Url%20%24site%20-UseWebLogin%0ASharePointPnPPowerShellOnline%5CGet-SPOProvisioningTemplate%20-Force%20-Out%20.%5Cmytemplate-weblogin.xml%0ASharePointPnPPowerShellOnline%5CSet-SPOTraceLog%20-Off%3C%2FTENANT%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20result%3A%3C%2FP%3E%3CP%3E-%20Using%20the%20-%3CSTRONG%3ECredential%3C%2FSTRONG%3E%20produces%20the%20xml%20%3CSTRONG%3EWITH%3C%2FSTRONG%3E%20the%20%3CSTRONG%3Epage%3C%2FSTRONG%3E%20content.%26nbsp%3B%3C%2FP%3E%3CP%3E-%20Using%20the%20-%3CSTRONG%3EUseWebLogin%3C%2FSTRONG%3E%20produces%20the%20xml%20%3CSTRONG%3EWITHOUT%3C%2FSTRONG%3E%20the%20%3CSTRONG%3Epage%3C%2FSTRONG%3E%20content.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20using%20only%20one%20and%20same%20credential%20in%20both%20cases.%20Result%20XML%20file%20is%20different.%3C%2FP%3E%3CP%3EI'm%20attaching%20the%20trace%20logs%20of%20both%20runs.%20The%20logs%20show%20that%20in%20-Credential%20case%20the%20Pages%20is%20handled%20(don't%20worry%20about%20the%20webpart%20warnings).%20In%20-UseWebLogin%20the%20Pages%20is%20not%20handled.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-26178%22%20slang%3D%22en-US%22%3ERe%3A%20Home.aspx%20content%20and%20webparts%20when%20extracting%20PnP%20site%20provisioning%20schema%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-26178%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Patri%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ei%20added%20my%20script%20which%20i%20default%20use%20hope%20it%20helps%20it%20has%20some%20overhead%20but%20it%20will%20give%20you%20the%20info%20you%20need.%3C%2FP%3E%3CPRE%3E%20%20%20Import-Module%20Microsoft.Online.SharePoint.PowerShell%20-DisableNameChecking%20%0A%20%20%20%20%20%20%20%20Get-Command%20-Module%20*PnP*%0A%24User%20%3D%20%22adm.XXX%40XXX.onmicrosoft.com%22%0A%24Site%20%3D%20%22https%3A%2F%2FXXXX.sharepoint.com%2Fsites%2FXXX%22%0A%24tennant%3D%22https%3A%2F%2FXXX-admin.sharepoint.com%2F%22%0A%24Password%20%3D%20Read-Host%20-Prompt%20%22Please%20enter%20your%20password%22%20-AsSecureString%0A%0A%0A%24Context%20%3D%20New-Object%20Microsoft.SharePoint.Client.ClientContext(%24tennant)%0A%0A%24Creds%20%3D%20New-Object%20Microsoft.SharePoint.Client.SharePointOnlineCredentials(%24User%2C%24Password)%0A%24Context.Credentials%20%3D%20%24Creds%0AConnect-SPOnline%20-Url%20%24Site%20-Credential%20%24cred%0AWrite-Output%20%22Context%20obtained%22%3B%0AGet-SPOProvisioningTemplate%20%20%20-Force%20-Out%20C%3A%5Ctemp%5CWorkflow.xml%20%3C%2FPRE%3E%3CP%3EAnd%20please%20make%20sure%20you%20use%20the%20latest%20Powershell%20command%20for%20SharePoint%20online%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-26172%22%20slang%3D%22en-US%22%3ERe%3A%20Home.aspx%20content%20and%20webparts%20when%20extracting%20PnP%20site%20provisioning%20schema%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-26172%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F8076%22%20target%3D%22_blank%22%3E%40Pasi%20Bergman%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20just%20tried%20creation%20a%20new%20site%20collection%20using%20the%20team%20site%20template.%20Then%20I%20exported%20it%20and%20I'm%20getting%20a%20lot%20more%20back.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Efor%20examples%20my%20sitefields%20look%20like%20this%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26lt%3B%20pnp%3A%20SiteFields%26gt%3B%3CBR%20%2F%3E%3CFIELD%20id%3D%22%26quot%3B%7Be954460e-4ac3-463a-a9c4-bf9e55564e24%7D%26quot%3B%22%20type%3D%22%26quot%3BDateTime%26quot%3B%22%20displayname%3D%22%26quot%3BLast%22%20shared%3D%22%22%20by%3D%22%22%20time%3D%22%22%3E%3C%2FFIELD%3E%3CBR%20%2F%3E%3CFIELD%20id%3D%22%26quot%3B%7Bef991a83-108d-4407-8ee5-ccc0c3d836b9%7D%26quot%3B%22%20type%3D%22%26quot%3BUserMulti%26quot%3B%22%20displayname%3D%22%26quot%3BShared%22%20with%3D%22%22%3E%3C%2FFIELD%3E%3CBR%20%2F%3E%3CFIELD%20id%3D%22%26quot%3B%7B725e8dc4-ee43-488a-94fa-85a380aa1302%7D%26quot%3B%22%20type%3D%22%26quot%3BNote%26quot%3B%22%20displayname%3D%22%26quot%3BLast%22%20shared%3D%22%22%20by%3D%22%22%20user%3D%22%22%3E%3C%2FFIELD%3E%3CBR%20%2F%3E%3CFIELD%20id%3D%22%26quot%3B%7Bd3c9caf7-044c-4c71-ae64-092981e54b33%7D%26quot%3B%22%20type%3D%22%26quot%3BNote%26quot%3B%22%20displayname%3D%22%26quot%3BShared%22%20with%3D%22%22%20details%3D%22%22%3E%3C%2FFIELD%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20almost%20looks%20like%20you%20haven't%20got%20the%20rigth%20permissions%20or%20something%20else%20is%20going%20wrong.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20looked%20at%20your%20connect-sponline%20command%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3EConnect-SPOnline%20-Url%20https%3A%2F%2Fmytenant.sharepoint.com%2Fsites%2Fmytemplatesite%20-UseWebLogin%0A%26nbsp%3B%3C%2FPRE%3E%3CP%3E%3CSPAN%3ECan%20you%20try%20without%20the%20-UseWebLogin%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3Eand%20use%20something%20like%20this%3A%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%24url%20%3D%20%22https%3A%2F%2Fmytenant.sharepoint.com%2Fsites%2Ftestteam%22%0A%24username%20%3D%20%22admin%40mytenant.onmicrosoft.com%22%0A%26nbsp%3B%26nbsp%3B%0Aif%20(%24credentials%20-eq%20%24null)%0A%7B%0A%24credentials%20%3D%20Get-Credential%20-Message%20%22Please%20supply%20password%22%20-UserName%20%24username%0AConnect-SPOnline%20%24url%20-Credentials%20%24credentials%0A%7D%0A%26nbsp%3B%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-26167%22%20slang%3D%22en-US%22%3ERe%3A%20Home.aspx%20content%20and%20webparts%20when%20extracting%20PnP%20site%20provisioning%20schema%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-26167%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F2387%22%20target%3D%22_blank%22%3E%40Pieter%20Veenstra%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20again%20for%20contributing.%20This%20issue%20is%26nbsp%3B%3CSPAN%3Equite%20annoying%20and%20any%20help%20is%20appreciated.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EAs%20I%20mentioned%2C%20the%20extracted%20provisioning%20template%20(xml)%26nbsp%3Bdoes%20not%20contain%20Pages%20element%20nor%20Page%20element.%20Below%20is%20the%20result%20of%20the%20initial%20schema%20extraction%3C%2FSPAN%3E%3C%2FP%3E%3CPRE%3EGet-SPOProvisioningTemplate%20-Out%20.%5Cmytemplatesite1.xml%26nbsp%3B%3C%2FPRE%3E%3CP%3E%3CSPAN%3EI%20have%20removed%20the%20content%20of%20the%20AdditionalAdministrators%2C%20SiteFields%20and%20ContentTypes%2C%20but%20I%20have%20not%20touched%20anything%20else.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%26lt%3B%3Fxml%20version%3D%221.0%22%3F%26gt%3B%0A%26lt%3Bpnp%3A%20Provisioning%20xmlns%3A%20pnp%3D%22http%3A%2F%2Fschemas.dev.office.com%2FPnP%2F2016%2F05%2FProvisioningSchema%22%26gt%3B%0A%20%20%26lt%3Bpnp%3A%20Preferences%20Generator%3D%22OfficeDevPnP.Core%2C%20Version%3D2.8.1610.1%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D3751622786b357c2%22%20%2F%26gt%3B%0A%20%20%26lt%3Bpnp%3A%20Templates%20ID%3D%22CONTAINER-TEMPLATE-2912D0BE8A6047548043990D05268BC2%22%26gt%3B%0A%20%20%20%20%26lt%3Bpnp%3A%20ProvisioningTemplate%20ID%3D%22TEMPLATE-2912D0BE8A6047548043990D05268BC2%22%20Version%3D%221%22%20BaseSiteTemplate%3D%22STS%230%22%26gt%3B%0A%20%20%20%20%20%20%26lt%3Bpnp%3A%20WebSettings%20RequestAccessEmail%3D%22someone%40example.com%22%20NoCrawl%3D%22false%22%20WelcomePage%3D%22SitePages%2FHome.aspx%22%20SiteLogo%3D%22%22%20AlternateCSS%3D%22%22%20MasterPageUrl%3D%22%7Bmasterpagecatalog%7D%2Fseattle.master%22%20CustomMasterPageUrl%3D%22%7Bmasterpagecatalog%7D%2Fseattle.master%22%20%2F%26gt%3B%0A%20%20%20%20%20%20%26lt%3Bpnp%3A%20RegionalSettings%20AdjustHijriDays%3D%220%22%20AlternateCalendarType%3D%22None%22%20CalendarType%3D%22Gregorian%22%20Collation%3D%2225%22%20FirstDayOfWeek%3D%22Sunday%22%20FirstWeekOfYear%3D%220%22%20LocaleId%3D%221033%22%20ShowWeeks%3D%22false%22%20Time24%3D%22false%22%20TimeZone%3D%2213%22%20WorkDayEndHour%3D%225%3A00PM%22%20WorkDays%3D%2262%22%20WorkDayStartHour%3D%228%3A00AM%22%20%2F%26gt%3B%0A%20%20%20%20%20%20%26lt%3Bpnp%3A%20SupportedUILanguages%26gt%3B%0A%20%20%20%20%20%20%20%20%26lt%3Bpnp%3A%20SupportedUILanguage%20LCID%3D%221033%22%20%2F%26gt%3B%0A%20%20%20%20%20%20%26lt%3B%2Fpnp%3A%20SupportedUILanguages%26gt%3B%0A%20%20%20%20%20%20%26lt%3Bpnp%3A%20AuditSettings%20AuditLogTrimmingRetention%3D%2290%22%20TrimAuditLog%3D%22true%22%26gt%3B%0A%20%20%20%20%20%20%20%20%26lt%3Bpnp%3A%20Audit%20AuditFlag%3D%22None%22%20%2F%26gt%3B%0A%20%20%20%20%20%20%26lt%3B%2Fpnp%3A%20AuditSettings%26gt%3B%0A%20%20%20%20%20%20%26lt%3Bpnp%3A%20Security%26gt%3B%0A%20%20%20%20%20%20%20%20%26lt%3Bpnp%3A%20AdditionalAdministrators%26gt%3B%0A%20%20%20%20%20%20%20%20%26lt%3B%2Fpnp%3A%20AdditionalAdministrators%26gt%3B%0A%20%20%20%20%20%20%20%20%26lt%3Bpnp%3A%20Permissions%20%2F%26gt%3B%0A%20%20%20%20%20%20%26lt%3B%2Fpnp%3A%20Security%26gt%3B%0A%20%20%20%20%20%20%26lt%3Bpnp%3A%20SiteFields%26gt%3B%0A%20%20%20%20%20%20%26lt%3B%2Fpnp%3A%20SiteFields%26gt%3B%0A%20%20%20%20%20%20%26lt%3Bpnp%3A%20ContentTypes%26gt%3B%0A%20%20%20%20%20%20%26lt%3B%2Fpnp%3A%20ContentTypes%26gt%3B%0A%20%20%20%20%20%20%26lt%3Bpnp%3A%20Features%26gt%3B%0A%20%20%20%20%20%20%20%20%26lt%3Bpnp%3A%20WebFeatures%26gt%3B%0A%20%20%20%20%20%20%20%20%20%20%26lt%3Bpnp%3A%20Feature%20ID%3D%22b77b6484-364e-4356-8c72-1bb55b81c6b3%22%20%2F%26gt%3B%0A%20%20%20%20%20%20%20%20%26lt%3B%2Fpnp%3A%20WebFeatures%26gt%3B%0A%20%20%20%20%20%20%26lt%3B%2Fpnp%3A%20Features%26gt%3B%0A%20%20%20%20%26lt%3B%2Fpnp%3A%20ProvisioningTemplate%26gt%3B%0A%20%20%26lt%3B%2Fpnp%3A%20Templates%26gt%3B%0A%26lt%3B%2Fpnp%3A%20Provisioning%26gt%3B%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEdit%3A%20I%20added%20spaces%20after%20each%26nbsp%3B%3CSTRONG%3Epnp%3A%3C%2FSTRONG%3E%20to%20remove%20the%20emojis%20from%20my%20reply.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-26165%22%20slang%3D%22en-US%22%3ERe%3A%20Home.aspx%20content%20and%20webparts%20when%20extracting%20PnP%20site%20provisioning%20schema%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-26165%22%20slang%3D%22en-US%22%3EWhen%20you%20export%20as%20.xml%20files%20the%20aspx%20page%20itself%20will%20not%20be%20exported.%3CBR%20%2F%3EYou%20can%20simple%20put%20an%20.aspx%20file%20in%20the%20same%20folder%20as%20the%20.xml%20manually%20before%20you%20import%20it.%20A%20simple%20one%20off%20export%20of%20the%20page%20with%20share%20point%20designer%20will%20do.%20You%20can%20then%20use%20this%20apsx%20file%20for%20any%20future%20pages.%3CBR%20%2F%3EIf%20you%20use%20.pnp%20rather%20than%20.xml%20then%20all%20will%20work%20fine.%3CBR%20%2F%3EDid%20you%20check%20you%20.xml%20files%3F%20If%20you%20search%20for%20webpart%20do%20you%20find%20anything%20in%20the%20xml%3F%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-26162%22%20slang%3D%22en-US%22%3ERe%3A%20Home.aspx%20content%20and%20webparts%20when%20extracting%20PnP%20site%20provisioning%20schema%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-26162%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%40Deleted%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGreat%20blog%20post!%20Thank%20you%20for%20sharing%20it.%20Your%20post%26nbsp%3Bwill%20certainly%20help%20after%20my%20initial%20problem%20has%20been%20resolved.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-26161%22%20slang%3D%22en-US%22%3ERe%3A%20Home.aspx%20content%20and%20webparts%20when%20extracting%20PnP%20site%20provisioning%20schema%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-26161%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F2387%22%20target%3D%22_blank%22%3E%40Pieter%20Veenstra%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20taking%20the%20time%20to%20reply.%20I%20really%26nbsp%3Bappreciate%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20expecting%20the%26nbsp%3B%3CSPAN%3EGet-SPOProvisioingTemplate%20to%20collect%20also%20the%20Home.aspx%20but%20the%20XML%20file%20I'm%20getting%20does%20not%20include%20Pages%20element%20and%20threfore%20no%20page%20content%20nor%20webpart%20either.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EThis%20is%20what%20I%20do...%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E1)%20I%20create%20a%20new%20SharePoint%20Online%20Team%20Site%20(English)%20with%20my%20account%20as%20the%20site%20collection%20administrator%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E2)%20I%20then%20edit%26nbsp%3Bthe%20welcome%20page%20%2FSitePages%2FHome.aspx.%20I%20remove%20the%20default%20content%20except%20for%20the%20Documents%20webpart.%20I%20also%20add%20some%20text%20to%20the%20wikifield%20content%20area%20and%20then%20I%20save%20the%20page.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E3)%20Using%20the%20%3CU%3Elatest%3C%2FU%3E%20PnP%20SharePoint%20Online%20PowerShell%20I%20then%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3EConnect-SPOnline%20-Url%20https%3A%2F%2Fmytenant.sharepoint.com%2Fsites%2Fmytemplatesite%20-UseWebLogin%0AGet-SPOProvisioningTemplate%20-Out%20.%5Cmytemplatesite1.xml%26nbsp%3B%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E6)%20I%20also%20try%3C%2FSPAN%3E%3C%2FP%3E%3CPRE%3EGet-SPOProvisioningTemplate%20-Out%20.%5Cmytemplatesite2.xml%20-PersistPublishingFiles%3C%2FPRE%3E%3CP%3E%3CSPAN%3Eand%3C%2FSPAN%3E%3C%2FP%3E%3CPRE%3EGet-SPOProvisioningTemplate%20-Out%20.%5Cmytemplatesite3.xml%20-IncludeNativePublishingFiles%3C%2FPRE%3E%3CP%3E%3CSPAN%3E%3CSTRONG%3ENone%20of%20these%20prorduce%20xml%20file%20with%20the%20Pages%20element%20and%20content%20of%20the%20Home.aspx%3C%2FSTRONG%3E%20(i.e.%20WebPart%20and%20WikiField%20contents).%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20won't%20attach%20the%20schema%20xml's.%20Hopefully%20everyone%20takes%20my%20word%20for%20it%20that%20the%20Pages%20there%20is%20no%20Pages%20nor%20Page%20element%20in%20those.%20I'm%20attaching%20the%20TRACE%20LOGs%20of%20the%20three%20Get-SPOProvisioningTemplate%20executions%20numbered%20as%201%2C%202%20and%203.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-26120%22%20slang%3D%22en-US%22%3ERe%3A%20Home.aspx%20content%20and%20webparts%20when%20extracting%20PnP%20site%20provisioning%20schema%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-26120%22%20slang%3D%22en-US%22%3E%3CP%3EBe%20aware%20that%20if%20you%20put%20webparts%20on%20the%20homepage%20which%20contain%20documents%2Flists%20that%20the%20view%20is%20not%20automaticly%20the%20same.%26nbsp%3B%3C%2FP%3E%3CP%3Echeck%20my%20blog%20about%20views%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22http%3A%2F%2Fwww.sharepoint-specialist.nu%2Funable-change-view-list-view-web-part-csom-solution-office365%2F%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fwww.sharepoint-specialist.nu%2Funable-change-view-list-view-web-part-csom-solution-office365%2F%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-26095%22%20slang%3D%22en-US%22%3ERe%3A%20Home.aspx%20content%20and%20webparts%20when%20extracting%20PnP%20site%20provisioning%20schema%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-26095%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F8076%22%20target%3D%22_blank%22%3E%40Pasi%20Bergman%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20Get-SPOProvisioingTemplate%20cmdlet%20collects%20the%20welcome%20page%20including%20web%20parts.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20assuming%20that%20you%20are%20extracting%20the%20template%20as%20a%20.pnp%20file.%20If%20you%20extract%20it%20as%20an%20.xml%20it%20will%20be%20easier%20to%20check%20if%20your%20page%2Fweb%20parts%20are%20included.%20Of%20course%20it%20is%20better%20to%20use%20the%20.pnp%20format%20for%20normal%20use%20but%20for%20debug%20purposes%20it%20can%20help%20to%20use%20the%20.xml%20format.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

Should I be able to get the page content of the site welcome page (e.g. /SitePages/Home.aspx) and its webparts using Get-SPOProvisioningTemplate (PowerShell) or GetProvisioningTemplate (C#)? I would think welcome page content and webpart extraction this is included in the core implementation as that is normally needed when extracting site schema.

 

How do I extract the SitePages/Home.aspx content with webparts? Do I need to implement an extensibility provider?

13 Replies
Highlighted

Hi @Pasi Bergman,

 

The Get-SPOProvisioingTemplate cmdlet collects the welcome page including web parts.

 

I'm assuming that you are extracting the template as a .pnp file. If you extract it as an .xml it will be easier to check if your page/web parts are included. Of course it is better to use the .pnp format for normal use but for debug purposes it can help to use the .xml format.

Highlighted

Be aware that if you put webparts on the homepage which contain documents/lists that the view is not automaticly the same. 

check my blog about views:

http://www.sharepoint-specialist.nu/unable-change-view-list-view-web-part-csom-solution-office365/

 

Highlighted

Hi @Pieter Veenstra 

 

Thank you for taking the time to reply. I really appreciate it.

 

I am expecting the Get-SPOProvisioingTemplate to collect also the Home.aspx but the XML file I'm getting does not include Pages element and threfore no page content nor webpart either.

 

This is what I do...

1) I create a new SharePoint Online Team Site (English) with my account as the site collection administrator

2) I then edit the welcome page /SitePages/Home.aspx. I remove the default content except for the Documents webpart. I also add some text to the wikifield content area and then I save the page.

3) Using the latest PnP SharePoint Online PowerShell I then

 

Connect-SPOnline -Url https://mytenant.sharepoint.com/sites/mytemplatesite -UseWebLogin
Get-SPOProvisioningTemplate -Out .\mytemplatesite1.xml 

 

6) I also try

Get-SPOProvisioningTemplate -Out .\mytemplatesite2.xml -PersistPublishingFiles

and

Get-SPOProvisioningTemplate -Out .\mytemplatesite3.xml -IncludeNativePublishingFiles

None of these prorduce xml file with the Pages element and content of the Home.aspx (i.e. WebPart and WikiField contents).

 

I won't attach the schema xml's. Hopefully everyone takes my word for it that the Pages there is no Pages nor Page element in those. I'm attaching the TRACE LOGs of the three Get-SPOProvisioningTemplate executions numbered as 1, 2 and 3.

Highlighted

Hi @Deleted

 

Great blog post! Thank you for sharing it. Your post will certainly help after my initial problem has been resolved.

Highlighted
When you export as .xml files the aspx page itself will not be exported.
You can simple put an .aspx file in the same folder as the .xml manually before you import it. A simple one off export of the page with share point designer will do. You can then use this apsx file for any future pages.
If you use .pnp rather than .xml then all will work fine.
Did you check you .xml files? If you search for webpart do you find anything in the xml?
Highlighted

Hi @Pieter Veenstra

 

Thanks again for contributing. This issue is quite annoying and any help is appreciated.

 

As I mentioned, the extracted provisioning template (xml) does not contain Pages element nor Page element. Below is the result of the initial schema extraction

Get-SPOProvisioningTemplate -Out .\mytemplatesite1.xml 

I have removed the content of the AdditionalAdministrators, SiteFields and ContentTypes, but I have not touched anything else.

 

<?xml version="1.0"?>
<pnp: Provisioning xmlns: pnp="http://schemas.dev.office.com/PnP/2016/05/ProvisioningSchema">
  <pnp: Preferences Generator="OfficeDevPnP.Core, Version=2.8.1610.1, Culture=neutral, PublicKeyToken=3751622786b357c2" />
  <pnp: Templates ID="CONTAINER-TEMPLATE-2912D0BE8A6047548043990D05268BC2">
    <pnp: ProvisioningTemplate ID="TEMPLATE-2912D0BE8A6047548043990D05268BC2" Version="1" BaseSiteTemplate="STS#0">
      <pnp: WebSettings RequestAccessEmail="someone@example.com" NoCrawl="false" WelcomePage="SitePages/Home.aspx" SiteLogo="" AlternateCSS="" MasterPageUrl="{masterpagecatalog}/seattle.master" CustomMasterPageUrl="{masterpagecatalog}/seattle.master" />
      <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" />
      <pnp: SupportedUILanguages>
        <pnp: SupportedUILanguage LCID="1033" />
      </pnp: SupportedUILanguages>
      <pnp: AuditSettings AuditLogTrimmingRetention="90" TrimAuditLog="true">
        <pnp: Audit AuditFlag="None" />
      </pnp: AuditSettings>
      <pnp: Security>
        <pnp: AdditionalAdministrators>
        </pnp: AdditionalAdministrators>
        <pnp: Permissions />
      </pnp: Security>
      <pnp: SiteFields>
      </pnp: SiteFields>
      <pnp: ContentTypes>
      </pnp: ContentTypes>
      <pnp: Features>
        <pnp: WebFeatures>
          <pnp: Feature ID="b77b6484-364e-4356-8c72-1bb55b81c6b3" />
        </pnp: WebFeatures>
      </pnp: Features>
    </pnp: ProvisioningTemplate>
  </pnp: Templates>
</pnp: Provisioning>

 

Edit: I added spaces after each pnp: to remove the emojis from my reply.

 

Highlighted

Hi @Pasi Bergman,

 

I just tried creation a new site collection using the team site template. Then I exported it and I'm getting a lot more back.

 

for examples my sitefields look like this:

 

< pnp: SiteFields>
<Field ID="{e954460e-4ac3-463a-a9c4-bf9e55564e24}" Type="DateTime" DisplayName="Last Shared By Time" Name="LastSharedByTime" StaticName="LastSharedByTime" Group="_Hidden" Sealed="TRUE" AllowDeletion="FALSE" ReadOnly="TRUE" ShowInDisplayForm="FALSE" ShowInEditForm="FALSE" ShowInListSettings="FALSE" Viewable="FALSE" SourceID="{808997ce-c646-44e1-aa26-8b96b3fa034c}" />
<Field ID="{ef991a83-108d-4407-8ee5-ccc0c3d836b9}" Type="UserMulti" DisplayName="Shared With" Mult="TRUE" Name="SharedWithUsers" StaticName="SharedWithUsers" Group="_Hidden" Sealed="TRUE" AllowDeletion="FALSE" ReadOnly="TRUE" ShowInDisplayForm="FALSE" ShowInEditForm="FALSE" ShowInListSettings="FALSE" Viewable="FALSE" SourceID="{808997ce-c646-44e1-aa26-8b96b3fa034c}" />
<Field ID="{725e8dc4-ee43-488a-94fa-85a380aa1302}" Type="Note" DisplayName="Last Shared By User" Name="LastSharedByUser" StaticName="LastSharedByUser" Group="_Hidden" Sealed="TRUE" AllowDeletion="FALSE" ReadOnly="TRUE" ShowInDisplayForm="FALSE" ShowInEditForm="FALSE" ShowInListSettings="FALSE" Viewable="FALSE" SourceID="{808997ce-c646-44e1-aa26-8b96b3fa034c}" />
<Field ID="{d3c9caf7-044c-4c71-ae64-092981e54b33}" Type="Note" DisplayName="Shared With Details" Name="SharedWithDetails" StaticName="SharedWithDetails" Group="_Hidden" Sealed="TRUE" AllowDeletion="FALSE" ReadOnly="TRUE" ShowInDisplayForm="FALSE" ShowInEditForm="FALSE" ShowInListSettings="FALSE" Viewable="FALSE" SourceID="{808997ce-c646-44e1-aa26-8b96b3fa034c}" />
</ pnp: SiteFields>

 

It almost looks like you haven't got the rigth permissions or something else is going wrong. 

 

I looked at your connect-sponline command:

 

 

Connect-SPOnline -Url https://mytenant.sharepoint.com/sites/mytemplatesite -UseWebLogin
 

Can you try without the -UseWebLogin

 

and use something like this:

 

 

$url = "https://mytenant.sharepoint.com/sites/testteam"
$username = "admin@mytenant.onmicrosoft.com"
  
if ($credentials -eq $null)
{
$credentials = Get-Credential -Message "Please supply password" -UserName $username
Connect-SPOnline $url -Credentials $credentials
}
 

 

 

Highlighted

Hi Patri,

 

i added my script which i default use hope it helps it has some overhead but it will give you the info you need.

   Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking 
        Get-Command -Module *PnP*
$User = "adm.XXX@XXX.onmicrosoft.com"
$Site = "https://XXXX.sharepoint.com/sites/XXX"
$tennant="https://XXX-admin.sharepoint.com/"
$Password = Read-Host -Prompt "Please enter your password" -AsSecureString


$Context = New-Object Microsoft.SharePoint.Client.ClientContext($tennant)

$Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User,$Password)
$Context.Credentials = $Creds
Connect-SPOnline -Url $Site -Credential $cred
Write-Output "Context obtained";
Get-SPOProvisioningTemplate   -Force -Out C:\temp\Workflow.xml 

And please make sure you use the latest Powershell command for SharePoint online 

Highlighted

Hi @Pieter Veenstra

 

Great suggestion. This issue is somehow related to the login method.

 

I execute the following PowerShell lines. Note! The SharePointPnPPowerShellOnline\ is there because of same names of the diefferent SharePointPnPPowerShell* modules have same cmdlet's with the same name ('clobber').

 

 

$site   = "https://mytenant.sharepoint.com/sites/pasi-test-template"

SharePointPnPPowerShellOnline\Set-SPOTraceLog -On -Level Debug -LogFile .\mytemplate-creds.log
# # Log in using network credentials - requires <tenant>.onmicrosoft.com account
#
$Creds = Get-Credential SharePointPnPPowerShellOnline\Connect-SPOnline -Url $site -Credential $Creds SharePointPnPPowerShellOnline\Get-SPOProvisioningTemplate -Force -Out .\mytemplate-creds.xml SharePointPnPPowerShellOnline\Set-SPOTraceLog -Off SharePointPnPPowerShellOnline\Set-SPOTraceLog -On -Level Debug -LogFile .\mytemplate-weblogin.log #
# Log in using Web Login - you can use any valid accout
# SharePointPnPPowerShellOnline\Connect-SPOnline -Url $site -UseWebLogin SharePointPnPPowerShellOnline\Get-SPOProvisioningTemplate -Force -Out .\mytemplate-weblogin.xml SharePointPnPPowerShellOnline\Set-SPOTraceLog -Off

 

The result:

- Using the -Credential produces the xml WITH the page content. 

- Using the -UseWebLogin produces the xml WITHOUT the page content.

 

I'm using only one and same credential in both cases. Result XML file is different.

I'm attaching the trace logs of both runs. The logs show that in -Credential case the Pages is handled (don't worry about the webpart warnings). In -UseWebLogin the Pages is not handled.

Highlighted

Same issue/feature exists in SharePointPnPPowerShell2013

 

$creds = Get-Credential
Connect-SPOnline -Url https://youronprem/sites/template -Credential $creds
Get-SPOProvisioningTemplate -Out .\onprem-template-creds.xml

Connect-SPOnline -Url https://youronprem/sites/template -CurrentCredentials
Get-SPOProvisioningTemplate -Out .\onprem-template-currentcreds.xml

Using -Credential produces XML schema WITH the page content and webparts

Using -CurrentCredentials produces XML schema WITHOUT the page content and webparts.

 

 

Highlighted
Highlighted
Solution

A little update from the PnP Core Team: I just changed the behaviour of the PageContents handler (which is the handler that extracts the homepage). It was checking for the presence of Credentials on the ClientContext and if not present it would not execute the extraction of artifacts. That check is still valid for On-Premises, due to the fact that we have to call a webservice to work around CSOM limitations, but is not needed anymore for SPO as that version of CSOM allows us to export all webparts. I now made that check conditional based upon the version of the NuGet package you're running, and it will be available in version 2.12.1702.0 (the February 2017 release).

Highlighted

I have the same issue and can only connect to sitecollections by the parameter -UseWeblogin because we are using ADFS and WMA. Please fix this or give me some workaround.