Forum Discussion
Get-PnPProvisioningTemplate failing with Object reference not set to an instance of an object
I change the release preferences to Targeted release for selected users (add my account),but no use.
HelloKanchanKumbhar !
Instrad of using the full path for the XML, does it work if you only type the file name? for example "template.xml" ?
Or is it the same issue?
If it still fails, try and enable custom scripts in SharePoint to test if that makes a difference
Kind Regards
Oliwer Sjöberg
- KanchanKumbharJan 16, 2020Copper ContributorDo you have any idea about this error?
- KanchanKumbharJan 13, 2020Copper Contributor
I have enabled the "Set-PnPTraceLog -On -Level Debug" and pl find below the logs - It seems it breaks at Retrieving current composed look...
PS C:\Windows\system32> Get-PnPProvisioningTemplate -Out "C:\temp\templateIntran etNews.xml" -PersistBrandingFiles -PersistPublishingFiles > c:\temp\pnplog.txt powershell.exe Information: 0 : 2020-01-13 10:30:19.2835 [Extraction] [14] [Debug] Code execution scope started 0ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:19.2845 [Extraction] [14] [Debug] Base template available: SITEPAGEPUBLISHING0template 0ms 065192fb-5393-4ee4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:19.2855 [Extraction] [14] [Debug] ProgressDelegate registered 1ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:19.2855 [Extraction] [14] [Debug] MessagesDelegate registered 1ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:19.2865 [Extraction] [14] [Debug] PersistBrandingFiles is set to true 2ms 065192fb-5393-4e e4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:20.7556 [Regional Settin gs] [14] [Debug] Code execution scope started 0ms 065192fb-5393-4e e4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:21.1086 [Regional Settin gs] [14] [Debug] Code execution scope ended 353ms 065192fb-5393-4e e4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:21.1196 [Supported UI La nguages] [14] [Debug] Code execution scope started 0ms 065192fb -5393-4ee4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:21.5066 [Supported UI La nguages] [14] [Debug] Code execution scope ended 386ms 065192fb -5393-4ee4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:21.5206 [Audit Settings] [14] [Debug] Code execution scope started 0ms 065192fb-5393-4e e4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:21.8736 [Audit Settings] [14] [Debug] Code execution scope ended 353ms 065192fb-5393-4e e4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:21.8856 [Site Security] [14] [Debug] Code execution scope started 0ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:23.3337 [Site Security] [14] [Debug] Skipping OOTB role definition Full Control 1448ms 065192fb -5393-4ee4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:23.3357 [Site Security] [14] [Debug] Skipping OOTB role definition Design 1450ms 065192fb-5393-4e e4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:23.3367 [Site Security] [14] [Debug] Skipping OOTB role definition Edit 1451ms 065192fb-5393-4e e4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:23.3377 [Site Security] [14] [Debug] Skipping OOTB role definition Contribute 1452ms 065192fb -5393-4ee4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:23.3387 [Site Security] [14] [Debug] Skipping OOTB role definition Read 1453ms 065192fb-5393-4e e4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:23.3407 [Site Security] [14] [Debug] Skipping OOTB role definition Limited Access 1454ms 065192fb -5393-4ee4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:23.5507 [Site Security] [14] [Debug] Processing Role Assignment Microsoft.SharePoint.Client.RoleAssig nment 1665ms 065192fb-5393-4ee4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:23.5517 [Site Security] [14] [Debug] Processing Role Assignment Microsoft.SharePoint.Client.RoleAssig nment 1666ms 065192fb-5393-4ee4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:23.5547 [Site Security] [14] [Debug] Processing Role Assignment Microsoft.SharePoint.Client.RoleAssig nment 1669ms 065192fb-5393-4ee4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:23.5557 [Site Security] [14] [Debug] Code execution scope ended 1670ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:23.5688 [Fields] [14] [Debug] Code execution scope started 0ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:31.3802 [Fields] [14] [Debug] Code execution scope ended 7810ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:31.4072 [Content Types] [14] [Debug] Code execution scope started 0ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:33.4424 [Content Types] [14] [Debug] Code execution scope ended 2035ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:33.4565 [List instances] [14] [Debug] Code execution scope started 0ms 065192fb-5393-4e e4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:41.1899 [Get Security] [14] [Debug] Code execution scope started 0ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:41.4159 [Get Security] [14] [Debug] Code execution scope ended 225ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:41.4169 [List instances] [14] [Debug] Adding list: Documents - Shared Documents 7960ms 065192fb-5393-4ee4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:44.8921 [Get Security] [14] [Debug] Code execution scope started 0ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:45.1421 [Get Security] [14] [Debug] Code execution scope ended 250ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:45.1461 [List instances] [14] [Debug] Adding list: Events - Lists/Events 11689ms 065192fb -5393-4ee4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:49.4554 [Get Security] [14] [Debug] Code execution scope started 0ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:49.6834 [Get Security] [14] [Debug] Code execution scope ended 228ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:49.6854 [List instances] [14] [Debug] Adding list: Form Templates - FormServerTemplates 16229ms 065192fb-5393-4ee4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:54.9027 [Get Security] [14] [Debug] Code execution scope started 0ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:55.1748 [Get Security] [14] [Debug] Code execution scope ended 272ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:30:55.1798 [List instances] [14] [Debug] Adding list: Site Assets - SiteAssets 21723ms 065192fb -5393-4ee4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:31:02.4732 [Get Security] [14] [Debug] Code execution scope started 0ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:31:02.7512 [Get Security] [14] [Debug] Code execution scope ended 278ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:31:02.7522 [List instances] [14] [Debug] Adding list: Site Pages - SitePages 29296ms 065192fb -5393-4ee4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:31:06.6195 [Get Security] [14] [Debug] Code execution scope started 0ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:31:06.8545 [Get Security] [14] [Debug] Code execution scope ended 235ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:31:06.8565 [List instances] [14] [Debug] Adding list: Style Library - Style Library 33400ms 065192fb-5393-4ee4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:31:06.8585 [List instances] [14] [Debug] Code execution scope ended 33402ms 065192fb-5393-4e e4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:31:06.8855 [Features] [14] [Debug] Code execution scope started 0ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:31:07.6215 [Features] [14] [Debug] Code execution scope ended 736ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:31:07.6536 [Composed Looks] [14] [Debug] Code execution scope started 0ms 065192fb-5393-4e e4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:31:07.6546 [Composed Looks] [14] [Information] Retrieving current composed look 1ms 065192fb-5393-4ee4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:31:10.0157 [Composed Looks] [14] [Debug] Code execution scope ended 2362ms 065192fb-5393-4e e4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:31:10.0297 [Page Contents] [14] [Debug] Code execution scope started 0ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:31:10.6957 [Page Contents] [14] [Debug] Code execution scope ended 665ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:31:10.7057 [Client Side Pag e Contents] [14] [Debug] Code execution scope started 0ms 065192fb -5393-4ee4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:31:11.7318 [Client Side Pag e Contents] [14] [Debug] Code execution scope ended 1025ms 065192fb -5393-4ee4-ac57-ee946bbde7e0 powershell.exe Information: 0 : 2020-01-13 10:31:11.7328 [Extraction] [14] [Debug] Code execution scope ended 52448ms 065192fb-5393-4ee4-ac57- ee946bbde7e0 Get-PnPProvisioningTemplate : Object reference not set to an instance of an object. At line:1 char:1 + Get-PnPProvisioningTemplate -Out "C:\temp\templateIntranetNews.xml" - ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : WriteError: (:) [Get-PnPProvisioningTemplate], N ullReferenceException + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Prov isioning.GetProvisioningTemplate PS C:\Windows\system32> - KanchanKumbharJan 13, 2020Copper Contributor
Good Morning !!!!oliwer_sundgren
Today I started script again to get the template, but unfortunately I got the same error object reference not found)
please find attachment for script
Got below error while getting template
- oliwer_sundgrenJan 10, 2020Iron Contributor
We are making progress! KanchanKumbhar 🙂
Seems like one value is null, could you provide me with the entire code you've typed?
Could be a variable that is incorrect or an icorrect parameter.Kind Regards
Oliwer - KanchanKumbharJan 10, 2020Copper Contributor
Hellooliwer_sundgren
Thank you so much!!
After enabling custom script ,I could able to get template.
But I am getting error now while applying the template