Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add-type -Path "C:admintoolsspOnlineDLLsMicrosoft.SharePoint.Client.dll"
- add-type -Path "C:admintoolsspOnlineDLLsMicrosoft.SharePoint.Client.Runtime.dll"
- $SiteUrl = "https://companyname.sharepoint.com/sites/mySPSite"
- $ListName = "testList"
- $UserName = "my.email@companyname.com"
- $SecurePassword = convertto-securestring -string "P@ssw0rd" -AsPlainText -force
- $ClientContext = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
- $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName, $SecurePassword)
- $ClientContext.Credentials = $credentials
- # Get List and List Items
- $List = $ClientContext.Web.Lists.GetByTitle($ListName)
- $ListItems = $List.GetItems([Microsoft.SharePoint.Client.CamlQuery]::CreateAllItemsQuery())
- $ClientContext.Load($List)
- $ClientContext.Load($ListItems)
- $ClientContext.ExecuteQuery()
- [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
- [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")
Add Comment
Please, Sign In to add comment