pnp / PnP-PowerShell

SharePoint PnP PowerShell CmdLets
https://pnp.github.io/powershell
Other
985 stars 665 forks source link

Improve exception message when a provisioning template cannot be loaded from a file #2934

Closed jackpoz closed 3 years ago

jackpoz commented 3 years ago

Type

Related Issues?

None

What is in this Pull Request ?

Currently a NullDereference exception is thrown if Add-PnPListFoldersToProvisioningTemplate is called with a path that doesn't exist: image

This PR handles the cases by throwing a FileNotFoundException with the path of the file: image

Steps to reproduce the issue:

Connect-PnPOnline "https://<tenant>.sharepoint.com/sites/<site>"
Add-PnPListFoldersToProvisioningTemplate -Path "SiteTemplate.pnp" -List "List name" -Recursive
erwinvanhunen commented 3 years ago

Thank you!