Guest User

Untitled

a guest
Nov 29th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
  2. [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")
  3.  
  4. $siteUrl = "https://mytenant.com"
  5. $username = Read-Host -Prompt "Enter user login name"
  6. $SecurePassword = Read-Host -Prompt "Enter user login password" -AsSecureString
  7. $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
  8.  
  9. $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $SecurePassword)
  10. $ctx.Credentials = $credentials
  11.  
  12. $rootWeb = $ctx.Site
  13. $ctx.Load($rootWeb)
  14. $ctx.ExecuteQuery()
  15. $caColl = $rootWeb.get_userCustomActions()
  16. $ctx.Load($caColl)
  17. $ctx.ExecuteQuery()
  18.  
  19. Write-Host 'Total number of custom actions: '$caColl.Count
Add Comment
Please, Sign In to add comment