I setup new Sharepoint list, customized the form using Power App and able to view it and add new data. Now trying to setup a connection to this list to extract items that were added and unable to see the list. Tried using Visual Basic code - libraries - Microsoft.SharePoint.Client.dll, Microsoft.SharePoint.Client.Runtime.dll - got error 'The remote server returned an error: (400) Bad request'. Please note that I used similar script to connect to a different Sharepoint list (different organization though) and it worked just fine. That tells me that some settings might be blocking me from accessing the list? The user account I'm using to connect - has Sharepoint owner full rights - so should be able to connect and see all lists. Tried to connect using Powershell code, using actual GUID for the list - got error: Exception calling "ExecuteQuery" with "0" argument(s): "List does not exist. The page you selected contains a list that does not exist. It may have been deleted by another user." List does exist and I can easily pull it up by URL.
The Powershell code:
#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
#Config Parameters
$SiteURL="https://xxx.sharepoint.com"
$ListGUID = [System.Guid]("38xxxxxx-xxxx-xxxx-xxxx-aef6bcxxxxx")
#Get Credentials to connect
$Cred= Get-Credential
#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
#Get List by id
$List=$Ctx.Web.Lists.GetById($ListGUID)
$Ctx.load($List)
$Ctx.ExecuteQuery()
Write-host "Total Number of List Items:"$List.ItemCount
Thank you!