Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Copy-PnPList Copies the list of the first Lookup field instead of the source list #3866

Closed
5 tasks
mstrblueskys opened this issue Apr 3, 2024 · 5 comments · Fixed by #3870
Closed
5 tasks
Assignees
Labels
bug Something isn't working

Comments

@mstrblueskys
Copy link

Reporting an Issue or Missing Feature

Reporting a bug

Expected behavior

When using Copy-PnPList is copying the wrong list. It copies the list in the first lookup column rather than the source list.

Actual behavior

Copy-PnPList -Identity [List Name or GUID] -Title [New Title] will create a list with the new title but it will copy the list of the first lookup field.

Steps to reproduce behavior

Please include complete script or code samples in-line or linked from gists

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

2.1.1

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

  • [X ] Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify
@mstrblueskys mstrblueskys added the bug Something isn't working label Apr 3, 2024
@jackpoz
Copy link
Contributor

jackpoz commented Apr 3, 2024

Using version 2.4.8.0 I can confirm the issue.

I create a parent list called "Countries" with Title and Continent columns:
image

Then a child list called "Cities" with Title, lookup on Countries and Languages:
image

I ran Copy-PnPList -Identity "Cities" -Title "Copy of Cities":
image

The result is not a copy of "Cities" but a copy of the lookup list "Countries":
image

@jackpoz
Copy link
Contributor

jackpoz commented Apr 3, 2024

This happens by the way because GetSiteScriptFromList() returns both lists and the current PnP PowerShell implementation renames them both, with the first one being created.

@jackpoz
Copy link
Contributor

jackpoz commented Apr 3, 2024

I created a PR at #3870 that copies the correct list:
image

@veronicageek
Copy link
Collaborator

Thanks @jackpoz for your help - I'll let @gautamdsheth review it 🙂

@mstrblueskys
Copy link
Author

Thanks @jackpoz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants