Create Site Contenttype with document template, PnP PowerShell Apply-ProvisioningTemplate error

Copper Contributor

I built a site (SiteCollection with only a rootweb) which has site content types that have an uploaded document template. 

 

I have enabled debugging (see attached log), and this shows that after creation of the first contenttype with an attached document template, the provisioning crashes with the error: 

 

I have verified this, because in the contenttype created (in the log it is called Word), there is no document template configured.

 

Is there a way to provision Document Templates in another way, or is there a way to fix the error?

 

 

Apply-PnPProvisioningTemplate : urlOfFile
Parameter name: Specified value is not supported for the urlOfFile parameter.
At C:\provisioning\customer\PowerShellProvisioning\ProvisioningTemplates.psm1:104 char:5
+     Apply-PnPProvisioningTemplate -Path $TemplateFile
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [Apply-PnPProvisioningTemplate], ServerException
    + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.ApplyProvisioningTemplate

 

5 Replies

Hi @Jeroen Derde,

 

I think that your issue may be similar to this one:

 

https://github.com/SharePoint/PnP-Sites-Core/issues/758

 

I remember stepping throguh the code and I noticed that if your document template name doesn't match the out of the box document template then things seems to go wrong.

 

What is the document tmeplate's file name on your content type in question?

 

 

@Pieter Veenstra: The templatename is word.dotx

 

But there is also a poweroint.potx and excel.xltx on a powerpoint and excel contenttype.

I can't use the default one's because I also want a DocumentSet derived contenttype in the library.

 

I was able to temporarily work around the problem by putting the templates in a "documenttemplate" doclib in the rootweb, and putting a relative path into the documenttemplate field. ie: /DocumentTemplate/word.dotx

 

Would still like to get it to work with the template uploaded to the contenttype. So I will try renaming it to DocumentTemplate.dotx

 

Hi Jeroen,

 

it is due to the fact that PNP was initialy for rootweb provisioning we have seen the same problems. 

What you could do is use the {site} token if available and be sure you also provision the file to the forms gallery if necessary of the lib

Hi All,

Yes have the same issue. Empty site collection, one content type with a Word template and one site colomn and I am not able to apply the template.

Placed the Word template in de source directory does not slove the issue.

 

Do I mis somthing?

 

Please help. 

 

Apply-PnPProvisioningTemplate : urlOfFile
Parameter name: Opgegeven waarde wordt niet ondersteund voor de parameter urlOfFile.
At line:1 char:1
+ Apply-PnPProvisioningTemplate -Path template.pnp
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [Apply-PnPProvisioningTemplate], ServerException
    + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.ApplyProvisioningTemplate

 

@Jeroen Bijdevier, The only way forward I found is manually edit the template.xml file and set the template to the default value and then manully aply the document tmeplate after the docuemnt has been applied.