PnP PowerShell
6 TopicsFacing issue in installing the Pnp PowerShell Module for SharePoint 2013/Online
Hi All, I am facing issue in installing the PnP PowerShell module for SharePoint 2013/online. Please let me know if anyone has faced such issue Chendrayan Venkatesan . Error Description: PS C:\WINDOWS\system32> Install-Module SharePointPnPPowerShell2013 PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'SharePointPnPPowerShell2013'. Try Get-PSRepository to see all available registered module repositories. At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809 char:21 + ... $null = PackageManagement\Install-Package @PSBoundParameters + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage PS C:\WINDOWS\system32> Install-Module SharePointPnPPowerShellOnline PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'SharePointPnPPowerShellOnline'. Try Get-PSRepository to see all available registered module repositories. At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809 char:21 + ... $null = PackageManagement\Install-Package @PSBoundParameters + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage PS C:\WINDOWS\system32> $PSVersionTable.PSVersion Major Minor Build Revision ----- ----- ----- -------- 5 1 17134 407 Thanks, Prabhu35KViews0likes5CommentsError when invoke PnP Template from legacy team site to modern team site
Hi , we have a legacy team site, which has a document library with 2013 workflows migrated in it. We want to create a test document library same columns under modern team site and perform some test on them. While deploying the exported template we are getting following error which seems like causing due to legacy and modern site difference. is there any work around that we can just move the document library to modern site with out any items in it? Error: Invoke-PnPSiteTemplate : Referenced content type 0x0120D520 not available in site or in template After some research, found this article but not sure how to use the fix in my case? https://techcommunity.microsoft.com/t5/sharepoint-developer/pnp-provisioning-framework-referenced-co... Thanks570Views0likes0Commentsget warning WARNING: Parameter 'Web' is obsolete. The -Web parameter will be removed in a future
hi, While using a pnp script I got a warning as below. Can you advise how to remove the warning WARNING: Parameter 'Web' is obsolete. The -Web parameter will be removed in a future release. thanks1.7KViews0likes3CommentsDynamically copy Sharepoint lists' content with circular lookups to the another site
Hello! For about two weeks I've been researching for a solution to move a couple of sites from one site to another. I've come up with two Powershell scripts, first, to create an exact copy of a source site's structure and second, to move all of the items, including lookup fields, to that site. The idea is to get all of the source list's items, populate the gaps between items with "dummies" or, better to be called, just empty records, upload it to the csv file and then, from the csv file to the destination site. At the end delete the dummies, directly from the list. It may sound dumb but I'm new into Powershell and Microsoft services at all. Scripts use PnP Powershell and work with Sharepoint Online sites. My problem is with multi lookup fields. I do not know how to correctly write them into the CSV file so they can be later uploaded in to hashtable and then, to the destination list. Also, maybe there is easier way to do such a thing, so I'd be glad if you could help me to find it out. Scripts: Script #1 - create a template, based on the source site's lists, and upload it to the specified site Connect-PnPOnline -Url https://myenvironment.sharepoint.com/sites/source_site -Interactive $template = "C:\Users\myuser\...\temp.xml" Get-PnPSiteTemplate -Out $template -ListsToExtract "list1", "list2", "list3" -Handlers Lists Connect-PnPOnline -Url https://myenvironment.sharepoint.com/sites/destination_site -Interactive Invoke-PnPSiteTemplate -Path $template Script #2 - copy the source site's items to the destiniation site's newly created lists Connect-PnPOnline -Url $source_site -Interactive $source_site = "https://myenvironment.sharepoint.com/sites/source_site" $destination_site = "https://myenvironment.sharepoint.com/sites/destnation_site" $source_list = read-host "Set the destination list: " $csv_path = "C:\Users\myuser\...\temp.csv" $fields = @(Get-PnPField -List $source_list -ReturnTyped | Where-Object { $_.Hidden -eq $false -and $_.ReadOnlyField -eq $false -and $_.InternalName -ne "Attachments" -and $_.InternalName -ne "ContentType" -or $_.InternalName -eq "ID"}).InternalName $dummies = 1..((Get-PnPListItem -List $source_list).Length*2) $list_items = Get-PnPListItem -List $source_list -Fields $fields $object_array = @() $list_items | ForEach-Object { $object = New-Object PSCustomObject $fields_values = Get-PnPProperty -ClientObject $_ -Property FieldValuesAsText ForEach($field in $fields) { if((Get-PnPField -List $source_list -Identity $field).TypeAsString -eq "Lookup") { Get-PnPListItem -List $source_list -Fields $field | Out-Null $lookup = [Microsoft.SharePoint.Client.FieldLookupValue]$_[$field] $object | Add-Member Noteproperty $field $lookup.LookupId } else { $object | Add-Member Noteproperty $field $fields_values[$field] } } $object_array += $object } for($i=1; $i -le $dummies.Length; $i++) { if($object_array.ID -notcontains $i){ $object = New-Object PSCustomObject ForEach($field in $fields) { if($field -eq "ID") { $object | Add-Member Noteproperty $field $i } else { $object | Add-Member Noteproperty $field 0 } } $object_array += $object } } $object_array = $object_array | Sort-Object -Property ID $object_array | Export-CSV $csv_path -NoTypeInformation -Encoding UTF8 $csv_table = Import-Csv $csv_path | Select * -ExcludeProperty ID Connect-PnPOnline -Url $destination_site -Interactive foreach($row in $csv_table) { $item_values = @{} $row.psobject.properties | Foreach {$item_values[$_.Name] = $_.Value} Add-PnPListItem -List $source_list -Values $item_values } $fields_to_delete = Get-PnPListItem -List $source_list foreach($element in $fields_to_delete) { if($element["Title"] -eq "0"){Remove-PnPListItem -List $source_list -Identity $element["ID"] -Force} } Thanks for help!935Views0likes0CommentsAdd-PnPClientSideWebPart : One or more errors occurred.
Why is this happening? Does not matter what kind of web part, this one a document library, I still get the same kind of error message. Using the latest version of PnP for SharePoint Online. I can create a page with PnP, add a Text part and so on... https://github.com/pnp/PnP-PowerShell/issues/2913 Add-PnPClientSideWebPart -Page $Page -DefaultWebPartType List -Section 1 -Column 1 -WebPartProperties @{isDocumentLibrary="true";selectedListId="a4140c74-b780-417c-89c1-381e24a6e699"} Add-PnPClientSideWebPart : One or more errors occurred. At line:1 char:1 + Add-PnPClientSideWebPart -Page $Page -DefaultWebPartType List -Sectio ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : WriteError: (:) [Add-PnPClientSideWebPart], AggregateException + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.WebParts.AddClientSideWebPart2.1KViews0likes1CommentFacing issue in installing the Pnp PowerShell Module for SharePoint 2013/Online
Hi All, I am facing issue in installing the PnP PowerShell module for SharePoint 2013/online. Please let me know if anyone has faced such issue Chendrayan Venkatesan . PFA for more info Thanks, Prabhu1.4KViews0likes4Comments