Guest User

Untitled

a guest
Nov 10th, 2017
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. add-type -Path "C:admintoolsspOnlineDLLsMicrosoft.SharePoint.Client.dll"
  2. add-type -Path "C:admintoolsspOnlineDLLsMicrosoft.SharePoint.Client.Runtime.dll"
  3. $SiteUrl = "https://companyname.sharepoint.com/sites/mySPSite"
  4. $ListName = "testList"
  5. $UserName = "my.email@companyname.com"
  6. $SecurePassword = convertto-securestring -string "P@ssw0rd" -AsPlainText -force
  7.  
  8. $ClientContext = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
  9. $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName, $SecurePassword)
  10. $ClientContext.Credentials = $credentials
  11.  
  12. # Get List and List Items
  13. $List = $ClientContext.Web.Lists.GetByTitle($ListName)
  14. $ListItems = $List.GetItems([Microsoft.SharePoint.Client.CamlQuery]::CreateAllItemsQuery())
  15. $ClientContext.Load($List)
  16. $ClientContext.Load($ListItems)
  17. $ClientContext.ExecuteQuery()
  18.  
  19. [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
  20. [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")
Add Comment
Please, Sign In to add comment