pnp / pnp/pnpframework

invoke-pnpsitetemplate : Object reference not set to an instance of an object

Open
#512 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
259
Forks
161
Avg merge
10h 33m
Merged PRs (30d)
1

Description

I am trying to apply site template using invoke-PnPSiteTemplate command in group site but getting error of Object reference not set to an instance of an object

below is error

Message          : Object reference not set to an instance of an object.
Stacktrace       :    at Microsoft.SharePoint.Client.FieldAndContentTypeExtensions.BestMatch(String contentTypeId, IEnumerable`1 contentTypeCollection)
                      at PnP.Framework.Provisioning.ObjectHandlers.ObjectListInstance.CreateView(Web web, View view, ViewCollection existingViews, List createdList, 
                   PnPMonitoredScope monitoredScope, TokenParser parser, Int32 currentViewIndex, Int32 total)
                      at PnP.Framework.Provisioning.ObjectHandlers.ObjectListInstance.ProcessViews(Web web, TokenParser parser, PnPMonitoredScope scope, ListInfo 
                   listInfo)
                      at PnP.Framework.Provisioning.ObjectHandlers.ObjectListInstance.ProvisionObjects(Web web, ProvisioningTemplate template, TokenParser parser, 
                   ProvisioningTemplateApplyingInformation applyingInformation)
                      at PnP.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.ApplyRemoteTemplate(Web web, ProvisioningTemplate template, 
                   ProvisioningTemplateApplyingInformation provisioningInfo, Boolean calledFromHierarchy, TokenParser tokenParser)
                      at PnP.PowerShell.Commands.Provisioning.Site.InvokeSiteTemplate.ExecuteCmdlet()
                      at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord()

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the stack-trace path through FieldAndContentTypeExtensions.BestMatch and PnP.Framework.Provisioning.ObjectHandlers.ObjectListInstance.CreateView, then reproduce the failure with Invoke-PnPSiteTemplate against a group site. Done means identifying the null input responsible and confirming that applying the reported site template no longer raises this exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.