Forum Discussion
Home.aspx content and webparts when extracting PnP site provisioning schema?
- Jan 13, 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
}
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