Hello, I am trying to modify the below to authenticate to SharePoint Online instead of OnPrem server? How can I achieve this? Thank you.
Connect to web service
$uri = "https://test.sharepoint.com/sites/teamsites/_vti_bin/lists.asmx"
$service = New-WebServiceProxy -uri $uri -Namespace SpWs -UseDefaultCredential
$xmlDoc = new-object System.Xml.XmlDocument
$listName = "TestList"
$viewFields = $xmlDoc.CreateElement("ViewFields")
$query = $xmlDoc.CreateElement("Query")
$list = $service.GetListItems($listname,$null, $null, $viewfields,$null,$null,$null)