Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

PNP List does not exist.

$
0
0

Hi All,

I am using pnp to log in few web properties to List. Such as Title, Url, Contract Number, etc.

Here is the step that I followed:

I am currently login to the admin page, 

then find the hub site I want.

Loop through all the sites associated with the bub.

And Log the properties to List located in the Hubsite.

I keep getting error List doesn't exist, which is true. Is there away I can access target site and the List

#connect to pnp site admin
Connect-PnPOnline -Url https://mytenat-admin.sharepoint.us
# get the Tenant and  hub site id
$hubSite = Get-PnPTenantSite "https://mytena.sharepoint.us/sites/HubSite"
$hubSiteId = $hubSite.HubSiteId

#get the list name to log
#Get list by Id =>null right now
$HubListId = Get-PnPList -Identity 728ddc0f-c9cf-46a1-9bd0-aa9ab3c2df76
# get all sites associated to the hub
$sites = Get-PnPTenantSite -Detailed
$sites | select url | % { 
  $s = Get-PnPTenantSite $_.url 
  if($s.hubsiteid -eq $hubSiteId){
     # Filter out sites associated to the current hub
    #$Values = @{"Title"=$s.Title;"Url"=$s.Path;}
     Add-PnPListItem -List $HubListId -Values  @{"Title"=$s.Title;"Url"=$s.Path;}
    #write-host $s.Title  -ForegroundColor Red $s.HubSiteId
      Write-Host "`t"$s.Title - $s.Path -ForegroundColor Yellow
  }
}

I keep getting the error below

Get-PnPList : List does not exist.
The page you selected contains a list that does not exist.  It may have been deleted by another user.
At line:1 char:14
+ ... HubListId = Get-PnPList -Identity 728ddc0f-c9cf-46a1-9bd0-aa9ab3c2df7 ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [Get-PnPList], ServerException
    + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Lists.GetList

Please help


Abenet


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>