powershell icon indicating copy to clipboard operation
powershell copied to clipboard

[BUG] Invoke-PnPSiteScript

Open jh-sigmadx opened this issue 4 months ago • 0 comments

Reporting an Issue or Missing Feature

Running "Invoke-PnPSiteScript" on a site to Update the list there - does not update the list or add the additional column In fact - the script exits complaining that the "List already Exists" The script was run once to create the list from the json file. The json file was then amended to include a brand new column (by extracting from an existing list again using: Get-PnPSiteScriptFromList -List $listName) The script was then run again on the same site, but giving the output:

Expected behavior

I expect the List schema to be Updated, and the new column added, as per the documentation here: https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-overview

This Documentation states: "Site scripts can be run again on the same site after provisioning. Site scripts are non-destructive, so when they run again, they ensure that the site matches the configuration in the script.

For example, if the site already has a list with the same name that the site script is creating, the site script will only add missing fields to the existing list."

Actual behavior

The Output for the "CreateSPList" action is:

ErrorCode : -2130575342 Outcome : 2 OutcomeText : List with name TestList already exists. Target : TargetId : Title : Create or update list "TestList"

Steps to reproduce behavior

Export a List to a json definition using Get-PnPSiteScriptFromList -List $listName > list.json Create a new list using Invoke-PnPSiteScript -Script list.json

Edit the List (manually) to add a new Column Repeat the above process to update the list.json, and to update the existing list with the additional column

What is the version of the Cmdlet module you are running?

I have tried with both version 2.12 and the nightly build 2.99.2

Which operating system/environment are you running PnP PowerShell on?

Linux - Powershell version 7.4.4

jh-sigmadx avatar Oct 22 '24 10:10 jh-sigmadx