Apply-PnPProvisioningTemplate : Value cannot be null. Parameter name: stream

%3CLINGO-SUB%20id%3D%22lingo-sub-43857%22%20slang%3D%22en-US%22%3EApply-PnPProvisioningTemplate%20%3A%20Value%20cannot%20be%20null.%20Parameter%20name%3A%20stream%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-43857%22%20slang%3D%22en-US%22%3E%3CP%3EGood%20Day%20Guys%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20get%20this%20error%20when%20trying%20to%20applying%20provisiioning%20template%20to%20a%20publishing%20site%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EScenario%3C%2FP%3E%3CP%3E1.%20Create%20a%20publishing%20site%20cllection%3C%2FP%3E%3CP%3E2.%20Added%20branding%20files%20(css%2C%20js%2C%20html%20file)%3C%2FP%3E%3CP%3EAll%20this%20works%20well%20and%20the%20site%20shows%20my%20branding%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThen%20I%20created%20a%20new%20publishing%20site%20collection%20used%20powershell%20to%20get%20the%20provisioning%20template%20i%20made%20sure%20to%20use%20%3CSTRONG%3E-PersistBrandingFiles.%26nbsp%3B%3C%2FSTRONG%3EI%20then%20attempted%20to%20appply%20the%20template%20using%20powersell%20with%20debug%20enabled%20and%20i%20got%20the%20error%3C%2FP%3E%3CP%3E%3CEM%3EApply-PnPProvisioningTemplate%20%3A%20Value%20cannot%20be%20null.%20Parameter%20name%3A%20stream%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3EThe%20log%20file%20had%3A%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CEM%3Epowershell.exe%20Error%3A%200%20%3A%202017-02-03%2009%3A51%3A33.5322%20%5BOfficeDevPnP.Core%5D%20%5B0%5D%20%5BError%5D%20File%20index.html%20not%20found%20in%20directory%20_catalogs%5Cmasterpage%5CBinaryArchitectProvisioningTest.%20Exception%20%3D%20Unable%20to%20find%20the%20specified%20file.%200ms%3CBR%20%2F%3Epowershell.exe%20Error%3A%200%20%3A%202017-02-03%2009%3A51%3A33.5327%20%5BOfficeDevPnP.Core%5D%20%5B0%5D%20%5BError%5D%20File%20index.html%20not%20found%20in%20directory%20_catalogs%5Cmasterpage%5CBinaryArchitectProvisioningTest.%20Exception%20%3D%20Unable%20to%20find%20the%20specified%20file.%200ms%20%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20index.html%20file%20i%20am%20sure%20exist%20in%20the%20original%20site%20collection%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-44142%22%20slang%3D%22en-US%22%3ERe%3A%20Apply-PnPProvisioningTemplate%20%3A%20Value%20cannot%20be%20null.%20Parameter%20name%3A%20stream%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-44142%22%20slang%3D%22en-US%22%3ESeems%20weird.%20Object%20Handler%20is%20considering%20.html%20files%2C%20and%20the%20GetFiles%20method%20works%20recursively%2C%20as%20far%20as%20I%20see.%3CBR%20%2F%3E%3CBR%20%2F%3Evar%20sourceFiles%20%3D%20GetFiles(masterPageGalleryFolder).Where(%3CBR%20%2F%3Ef%20%3D%26gt%3B%20f.Name.EndsWith(%22.aspx%22%2C%20StringComparison.InvariantCultureIgnoreCase)%20%7C%7C%3CBR%20%2F%3Ef.Name.EndsWith(%22.html%22%2C%20StringComparison.InvariantCultureIgnoreCase)%20%7C%7C%3CBR%20%2F%3Ef.Name.EndsWith(%22.master%22%2C%20StringComparison.InvariantCultureIgnoreCase))%3B%3CBR%20%2F%3E%3CBR%20%2F%3EAre%20you%20using%20latest%20PnP%20Core%20dll%20version%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-44141%22%20slang%3D%22en-US%22%3ERe%3A%20Apply-PnPProvisioningTemplate%20%3A%20Value%20cannot%20be%20null.%20Parameter%20name%3A%20stream%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-44141%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20index.html%20file%20seems%20to%20be%20not%20saved%20together%20with%20your%20template%20as%20part%20of%20the%20%3CSTRONG%3E-PersistBrandingFiles%3C%2FSTRONG%3E%20.%20I%20think%20this%20is%20a%20bug%20%2F%20missing%20feature%20in%20Office%20Dev%20PnP.%20As%20a%20quick%20fix%20you%20could%26nbsp%3Bmanually%20make%20sure%20the%20file%20is%20in%20your%20template.%20If%20you%20have%20more%20time%20you%20could%20fix%20this%20in%20Office%20Dev%20PnP%20and%20submit%20a%20pull%20request%20%3A)%3C%2Fimg%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-44133%22%20slang%3D%22en-US%22%3ERe%3A%20Apply-PnPProvisioningTemplate%20%3A%20Value%20cannot%20be%20null.%20Parameter%20name%3A%20stream%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-44133%22%20slang%3D%22en-US%22%3E%3CP%3EWhat%20do%20you%20mean%20with%20when%20i%20unzip%20the%20files%3F%20you%20do%20not%20have%20them%20fysicly%20in%20a%20directory%3F%3C%2FP%3E%3CP%3Eand%20how%20does%20the%20xml%20look%20as%20it%20is%20a%20first%20starting%20point.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-44099%22%20slang%3D%22en-US%22%3ERe%3A%20Apply-PnPProvisioningTemplate%20%3A%20Value%20cannot%20be%20null.%20Parameter%20name%3A%20stream%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-44099%22%20slang%3D%22en-US%22%3E%3CP%3Ein%20the%20xml%20file%20I%20see%20it%20make%20references%20to%20index.html%20however%20when%20i%20unzip%20.pnp%20by%20renaming%20it%20to%20a%20.zip%20file%20i%20dont%20see%20this%20file%20being%20provisioned.%20Any%20Ideas%3F%20What%20could%20prevent%20it%20from%20being%20provisioned%3F%20When%20i%20use%20designer%20and%20make%20changes%20to%20the%20index.html%20file%20it%20automatically%20updates%20the%20index.master%20file%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-43992%22%20slang%3D%22en-US%22%3ERe%3A%20Apply-PnPProvisioningTemplate%20%3A%20Value%20cannot%20be%20null.%20Parameter%20name%3A%20stream%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-43992%22%20slang%3D%22en-US%22%3E%3CP%3ECan%20you%20add%20the%20xml%3F%20and%20check%20your%20resource%20directory%20if%20the%20files%20can%20be%20found%20in%20that%20directory%20where%20you%20are%20running%20your%20PS%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

Good Day Guys,

 

I get this error when trying to applying provisiioning template to a publishing site

 

Scenario

1. Create a publishing site cllection

2. Added branding files (css, js, html file)

All this works well and the site shows my branding

 

Then I created a new publishing site collection used powershell to get the provisioning template i made sure to use -PersistBrandingFiles. I then attempted to appply the template using powersell with debug enabled and i got the error

Apply-PnPProvisioningTemplate : Value cannot be null. Parameter name: stream

 

The log file had:

powershell.exe Error: 0 : 2017-02-03 09:51:33.5322 [OfficeDevPnP.Core] [0] [Error] File index.html not found in directory _catalogs\masterpage\BinaryArchitectProvisioningTest. Exception = Unable to find the specified file. 0ms
powershell.exe Error: 0 : 2017-02-03 09:51:33.5327 [OfficeDevPnP.Core] [0] [Error] File index.html not found in directory _catalogs\masterpage\BinaryArchitectProvisioningTest. Exception = Unable to find the specified file. 0ms

 

This index.html file i am sure exist in the original site collection

 

5 Replies

Can you add the xml? and check your resource directory if the files can be found in that directory where you are running your PS

in the xml file I see it make references to index.html however when i unzip .pnp by renaming it to a .zip file i dont see this file being provisioned. Any Ideas? What could prevent it from being provisioned? When i use designer and make changes to the index.html file it automatically updates the index.master file

 

What do you mean with when i unzip the files? you do not have them fysicly in a directory?

and how does the xml look as it is a first starting point.

 

 

The index.html file seems to be not saved together with your template as part of the -PersistBrandingFiles . I think this is a bug / missing feature in Office Dev PnP. As a quick fix you could manually make sure the file is in your template. If you have more time you could fix this in Office Dev PnP and submit a pull request :)

Seems weird. Object Handler is considering .html files, and the GetFiles method works recursively, as far as I see.

var sourceFiles = GetFiles(masterPageGalleryFolder).Where(
f => f.Name.EndsWith(".aspx", StringComparison.InvariantCultureIgnoreCase) ||
f.Name.EndsWith(".html", StringComparison.InvariantCultureIgnoreCase) ||
f.Name.EndsWith(".master", StringComparison.InvariantCultureIgnoreCase));

Are you using latest PnP Core dll version?