pnp / PnP-Sites-Core

Microsoft 365 Dev PnP Core component (.NET) targeted for increasing developer productivity with CSOM based solutions.
Other
415 stars 642 forks source link

Object reference not set to an instance of an object on server. The object is associated with #1534

Open Pieter-Veenstra opened 6 years ago

Pieter-Veenstra commented 6 years ago

Category

[X] Bug [ ] Enhancement

Environment

[ ] Office 365 / SharePoint Online [X] SharePoint 2016 [ ] SharePoint 2013

If SharePoint on-premises, what's exact CU version: 16.0.4327.1000

Expected or Desired Behavior

During the export the following lines are created in the Security -> Permissions -> RoleAssignments section of the template:

            <pnp:RoleAssignment Principal="{associatedownergroup}" RoleDefinition="{roledefinition:Administrator}" />
            <pnp:RoleAssignment Principal="{associatedvisitorgroup}" RoleDefinition="{roledefinition:Reader}" />
            <pnp:RoleAssignment Principal="{associatedmembergroup}" RoleDefinition="{roledefinition:Editor}" />

During the import you would expect these to be handled.

Observed Behavior

When applying the template I get:

Apply-PnPProvisioningTemplate : Object reference not set to an instance of an object on server. The object is associated with 
property AssociatedVisitorGroup.
At line:1 char:1
+ Apply-PnPProvisioningTemplate -Path C:\temp\template.xml
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [Apply-PnPProvisioningTemplate], ServerObjectNullReferenceException
    + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.ApplyProvisioningTemplate

Removing the above lines resolves the issue, but does make automating site creation a harder task.

Steps to Reproduce

Not 100% sure at this stage.

I've got a STS#0 site collection in SharePoint 2016.

maciaszek commented 6 years ago

Hello @Pieter-Veenstra,

I've got similar issue in my project. Have you managed to solve this problem?

rfeagley commented 5 years ago

I experience the same issue when any of the default groups are not present