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

%3CLINGO-SUB%20id%3D%22lingo-sub-33852%22%20slang%3D%22en-US%22%3ECreate%20Site%20Contenttype%20with%20document%20template%2C%20PnP%20PowerShell%20Apply-ProvisioningTemplate%20error%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-33852%22%20slang%3D%22en-US%22%3E%3CP%3EI%20built%20a%20site%20(SiteCollection%20with%20only%20a%20rootweb)%20which%20has%20site%20content%20types%20that%20have%20an%20%3CSTRONG%3Euploaded%3C%2FSTRONG%3E%20document%20template.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20enabled%20debugging%20(see%20attached%20log)%2C%20and%20this%20shows%20that%20after%20creation%20of%20the%20first%20contenttype%20with%20an%20attached%20document%20template%2C%20the%20provisioning%20crashes%20with%20the%20error%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20verified%20this%2C%20because%20in%20the%20contenttype%20created%20(in%20the%20log%20it%20is%20called%20%3CEM%3EWord%3C%2FEM%3E)%2C%20there%20is%20no%20document%20template%20configured.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20way%20to%20provision%20Document%20Templates%20in%20another%20way%2C%20or%20is%20there%20a%20way%20to%20fix%20the%20error%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3EApply-PnPProvisioningTemplate%20%3A%20urlOfFile%0AParameter%20name%3A%20Specified%20value%20is%20not%20supported%20for%20the%20urlOfFile%20parameter.%0AAt%20C%3A%5Cprovisioning%5Ccustomer%5CPowerShellProvisioning%5CProvisioningTemplates.psm1%3A104%20char%3A5%0A%2B%20%20%20%20%20Apply-PnPProvisioningTemplate%20-Path%20%24TemplateFile%0A%2B%20%20%20%20%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%0A%20%20%20%20%2B%20CategoryInfo%20%20%20%20%20%20%20%20%20%20%3A%20WriteError%3A%20(%3A)%20%5BApply-PnPProvisioningTemplate%5D%2C%20ServerException%0A%20%20%20%20%2B%20FullyQualifiedErrorId%20%3A%20EXCEPTION%2CSharePointPnP.PowerShell.Commands.Provisioning.ApplyProvisioningTemplate%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-73282%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20Site%20Contenttype%20with%20document%20template%2C%20PnP%20PowerShell%20Apply-ProvisioningTemplate%20error%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-73282%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F57591%22%20target%3D%22_blank%22%3E%40Jeroen%20Bijdevier%3C%2FA%3E%2C%20The%20only%20way%20forward%20I%20found%20is%20manually%20edit%20the%20template.xml%20file%20and%20set%20the%20template%20to%20the%20default%20value%20and%20then%20manully%20aply%20the%20document%20tmeplate%20after%20the%20docuemnt%20has%20been%20applied.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-73281%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20Site%20Contenttype%20with%20document%20template%2C%20PnP%20PowerShell%20Apply-ProvisioningTemplate%20error%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-73281%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20All%2C%3C%2FP%3E%3CP%3EYes%20have%20the%20same%20issue.%20Empty%20site%20collection%2C%20one%20content%20type%20with%20a%20Word%20template%20and%20one%20site%20colomn%20and%20I%20am%20not%20able%20to%20apply%20the%20template.%3C%2FP%3E%3CP%3EPlaced%20the%20Word%20template%20in%20de%20source%20directory%20does%20not%20slove%20the%20issue.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDo%20I%20mis%26nbsp%3Bsomthing%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20help.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EApply-PnPProvisioningTemplate%20%3A%20urlOfFile%3CBR%20%2F%3EParameter%20name%3A%20Opgegeven%20waarde%20wordt%20niet%20ondersteund%20voor%20de%20parameter%20urlOfFile.%3CBR%20%2F%3EAt%20line%3A1%20char%3A1%3CBR%20%2F%3E%2B%20Apply-PnPProvisioningTemplate%20-Path%20template.pnp%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2B%20CategoryInfo%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3A%20WriteError%3A%20(%3A)%20%5BApply-PnPProvisioningTemplate%5D%2C%20ServerException%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2B%20FullyQualifiedErrorId%20%3A%20EXCEPTION%2CSharePointPnP.PowerShell.Commands.Provisioning.ApplyProvisioningTemplate%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-33939%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20Site%20Contenttype%20with%20document%20template%2C%20PnP%20PowerShell%20Apply-ProvisioningTemplate%20error%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-33939%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Jeroen%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eit%20is%20due%20to%20the%20fact%20that%20PNP%20was%20initialy%20for%20rootweb%20provisioning%20we%20have%20seen%20the%20same%20problems.%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20you%20could%20do%20is%20use%20the%20%7Bsite%7D%20token%20if%20available%20and%20be%20sure%20you%20also%20provision%20the%20file%20to%20the%20forms%20gallery%20if%20necessary%20of%20the%20lib%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-33875%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20Site%20Contenttype%20with%20document%20template%2C%20PnP%20PowerShell%20Apply-ProvisioningTemplate%20error%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-33875%22%20slang%3D%22en-US%22%3E%3CP%3E%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%3A%20The%26nbsp%3Btemplatename%20is%20word.dotx%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20there%20is%20also%20a%20poweroint.potx%20and%20excel.xltx%20on%20a%20powerpoint%20and%20excel%20contenttype.%3C%2FP%3E%3CP%3EI%20can't%20use%20the%20default%20one's%20because%20I%20also%20want%20a%20DocumentSet%20derived%20contenttype%20in%20the%20library.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20was%20able%20to%20temporarily%20work%20around%20the%20problem%20by%20putting%20the%20templates%20in%20a%20%22documenttemplate%22%20doclib%20in%20the%20rootweb%2C%20and%20putting%20a%20relative%20path%20into%20the%20documenttemplate%20field.%20ie%3A%20%2FDocumentTemplate%2Fword.dotx%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWould%20still%20like%20to%20get%20it%20to%20work%20with%20the%20template%20uploaded%20to%20the%20contenttype.%20So%20I%20will%20try%20renaming%20it%20to%20DocumentTemplate.dotx%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-33868%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20Site%20Contenttype%20with%20document%20template%2C%20PnP%20PowerShell%20Apply-ProvisioningTemplate%20error%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-33868%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F33056%22%20target%3D%22_blank%22%3E%40Jeroen%20Derde%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20think%20that%20your%20issue%20may%20be%20similar%20to%20this%20one%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FSharePoint%2FPnP-Sites-Core%2Fissues%2F758%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2FSharePoint%2FPnP-Sites-Core%2Fissues%2F758%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20remember%20stepping%20throguh%20the%20code%20and%20I%20noticed%20that%20if%20your%20document%20template%20name%20doesn't%20match%20the%20out%20of%20the%20box%20document%20template%20then%26nbsp%3Bthings%20seems%20to%20go%20wrong.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20is%20the%20document%20tmeplate's%20file%20name%26nbsp%3Bon%20your%20content%20type%20in%20question%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New 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
Highlighted

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?

 

 

Highlighted

@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

 

Highlighted

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

Highlighted

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

 

Highlighted

@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.