Print Web Client Object properties
Add-Type -Path 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\Microsoft.SharePoint.Client.dll' | |
Add-Type -Path 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\Microsoft.SharePoint.Client.Runtime.dll' | |
function PrintWebProperties() | |
{ | |
param( | |
[Parameter(Mandatory=$true)][string]$url, | |
[Parameter(Mandatory=$false)][System.Net.NetworkCredential]$credentials | |
) | |
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($url) | |
$ctx.Credentials = $credentials | |
$web = $ctx.Web | |
Invoke-LoadMethod -ClientObject $web | |
$ctx.ExecuteQuery() | |
Write-Host "Web Properties:" | |
Write-Host "Title: $($web.Title)" | |
Write-Host "Url: $($web.ServerRelativeUrl)" | |
} | |
$credentials = New-Object System.Net.NetworkCredential('username', 'password','domain') | |
$url = 'http://contoso.intranet.com/' | |
PrintWebProperties $url $credentials |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment