Forum Discussion
Home.aspx content and webparts when extracting PnP site provisioning schema?
- Jan 14, 2017
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).
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 }
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.
- Pasi BergmanNov 01, 2016Copper Contributor
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.
- Pasi BergmanNov 03, 2016Copper Contributor
Continues as an reported issue
https://github.com/OfficeDev/PnP-Sites-Core/issues/838
- Jan 14, 2017
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).