5

I have done a similar thing recently and have written an article about it. You can easily achieve this by running some SharePoint PowerShell commands. Connect-SPOService -Url https://yoursharepoint-admin.sharepoint.com Set-SPOsite https://yoursharepinttenant.sharepoint.com/sites/yoursharepointsite -DenyAddAndCustomizePages 0 Connect-PnPOnline https://...


4

i managed to do this by adding rows as XML, a alternative option for some scenarios, perhaps? <pnp:Lists> <pnp:ListInstance Title="bookings" Description="bookings list demo" TemplateType="100" Url="Lists/bookings" > <pnp:DataRows UpdateBehavior="Overwrite"> <pnp:DataRow> <pnp:DataValue FieldName="...


4

This is by design. PnP will only migrate the structure and content types and not data. To provision the data, you will need to write a custom extensibility provider. You need to write that in your provisioning template xml somewhat as below: <pnp:Providers> <pnp:Provider Enabled="true" HandlerType="PnP.ExtensibilityProviders.CustomProvider, ...


3

You can use the {{listid:ListName}} token instead of hard-coding the GUID. When you use this token , the provisioning engine will fix the placeholder with the actual value of the List ID. For example, if your list/document library name is Documents, use {{listid:Documents}}. Put the below line of code in your template xml file and then PnP will fix it for ...


2

I found another solution which is better than my previous solution. In your Visual Studio you have publish profiles. In your publish profile you can go to settings. Disable the option: Precompile during publishing. Now you can publish your MVC web project without errors about the SharePoint token in the VirtualPath.


2

It is not possible to use the SharePoint token ~TemplatePageUrl in the virtualPath. I fixed it by my self. I renamed the Home.aspx to Home.txt. Now I can do a publish. After the publish I use gulp to create a deployment package. Inside gulp js code I rename the Home.txt back to Home.aspx. Here is my gulp js code: gulp.task('fixPublishingPages', function () ...


2

Using the content type hub will ensure that the site columns and content types will be available on every site collection and makes updates across the tenant pretty easy. The downside is that we'll have to wait for the timer job to kick in. If you deploy the content types by hand or using some kind of framework then the content type will be available right ...


1

I think you are stuck with using JSON I'm afraid. Have you tried using e.g. this tool to get a start on the JSON? https://www.sitedesigner.io/#/ so that you do not have to start from scratch.


1

you should create a test page with all your web parts then with pnp get your page as file $toSave = $file.ListItemAllFields["CanvasContent1"] in $toSave there is html for WebParts put $toSave html in an text file then add a page with Add-PnPClientSidePage then get your page with Get-PnPClientSidePage set property with your previoulsy save html: $...


1

You first need to connect to your SharePoint Online tenant using the Connect-PnPOnline. After that, you need to fetch all the modern group/team sites and then you need to connect to each one of then and apply your template. You can follow the below script. Ensure that you have SharePoint Admin rights else it wont work and you will get access denied or other ...


1

I do my provisioning for SharePoint online with Azure Functions and for me the cost has been nothing or cents in small environments. It all depends on your usage. You only pay for what you use and you get free usage every month: https://azure.microsoft.com/en-us/pricing/details/functions/ The only downside of an Azure Function is the maximal runtime of 5 ...


1

CTs are provisioned from the CTHub to the Site Collection which runs on a timer job. Yes, after a new SC is provisioned, you will have to wait for the timer job to complete a run.


1

This is the approach I use. The problem with SP Online and remote APIs is that you have no access to a strongly-typed XsltListView webpart object, so you're stuck importing an XML-based web part and swapping out the placeholders as you've done. I don't know what your provisioning process is like, but the ones I use are typically fully automated WebJobs and ...


1

You are passing the string incorrectly. Enclose it inside @' and '@ as mentioned below: $pnpTemplate = @' { "$schema": "schema.json", "actions": [ { "verb": "createSPList", "listName": "Customer Tracking", "templateType": 100, "subactions": [ { "verb": "SetDescription", "description": "List of ...


1

It seems that the engine did not have support for disabling comments on moderns pages at the time of this question. This is now supported according to the update notes for May 2018 update Added CommentsOnSitePagesDisabled property on web settings element in the provisioning engine.


1

In my experience, the PNP provisioning cmdlets are sometimes buggy, and is not yet full featured, although new features are appearing all the time. For now, you can change the "Comments" on a modern page after the page has been created. To disable the comments on a modern page called "Test.aspx": Set-PnPClientSidePage -Identity "Test.aspx" -...


1

As mentioned by Amy, you need to switch the context to a site collection context from the tenant context. The sharepoint admin site doesn't have the site pages library, so its throwing that error. You can make use of PnP's clone method to "take over" the security context of existing client context instance as below: Modify your code as below: var tenant ...


1

In the samples in the articles below, when creating a new client-side page, finally save the page to the site pages library. https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/modern-experience-customizations-customize-pages And there is no sitepages library in the site https://tenant-admin.sharepoint.com, it will throw the error. So we ...


1

If you have Page Layout that includes predefined Web Parts in the Web Part zones, these web parts will be added whenever the Page Layout is applied, please check this is not the case in your situation.


1

In CSOM and hence in PnP guidance, there is no equivalent to MetadataNavigationSettings that we find in the Server Object Model 2013. But there is a hack available which via property bag using CSOM. By setting the property bag value, you would be able to achieve the Metadata navigation setting. Try the below code: private static void ...


1

For #1 - in the past I've tried different approaches without success. Finally as workaround I had to put script editor web part to the page with link to stylescheet and hided toolbar with css... Good to know you resolved your #2 issue!


Only top voted, non community-wiki answers of a minimum length are eligible