Connect SharPoint Online WebService

Tan Phat Huynh 41 Reputation points
2021-08-03T20:00:43.527+00:00

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)

Microsoft 365 and Office | SharePoint Server | Development

2 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    2 deleted comments

    Comments have been turned off. Learn more

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    4 deleted comments

    Comments have been turned off. Learn more

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.