Forum Discussion
Apply-PnPProvisioningTemplate : Value cannot be null. Parameter name: stream
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
- Deleted
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
- Debayo GrahamBrass Contributor
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
- Deleted
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.
- paulpaschaBronze Contributor
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?