Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. [Reflection.Assembly]::LoadFrom("$scriptdirMicrosoft.SharePoint.Client.dll")
  2. $context = New-Object Microsoft.SharePoint.Client.ClientContext($siteURL)
  3. $context.RequestTimeOut = 1000 * 60 * 10;
  4. $context.AuthenticationMode = [Microsoft.SharePoint.Client.ClientAuthenticationMode]::Default
  5. $securePassword = ConvertTo-SecureString $password -AsPlainText -Force
  6. $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $securePassword)
  7. $context.Credentials = $credentials
  8. $web = $context.Web
  9. $site = $context.Site
  10. $context.Load($web)
  11. $context.Load($site)
  12. $context.ExecuteQuery()
  13. Set-Variable -Name "clientContext" -Value $context -Scope Global
  14. Set-Variable -Name "rootSiteUrl" -Value $siteURL -Scope Global
  15. Function Get-CQList {
  16. $listName = "Tasks"
  17. $list = $clientContext.Web.Lists.GetByTitle($listName)
  18. $cq = new-object Microsoft.Sharepoint.Client.ChangeQuery($true,$true)
  19. $col = new-object Microsoft.Sharepoint.Client.ChangeCollection #returns "Constructor not found. Cannot find an appropriate constructor for type Microsoft.Sharepoint.Client.ChangeCollection"
  20. $col = $list.GetChanges($cq)
  21. $clientContext.ExecuteQuery()
  22. $col.AreItemsAvailable #returns false
  23. foreach ($item in $col) {
  24. # get data here from specific column name/row
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement