I'm trying a very simple piece of PowerShell v2 code to get the title of a site using CSOM and REST:
[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SharePoint.Client') | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName('System.Net') | Out-Null
$siteUrl="http://sitecollectionurl"
$svcUrl=$siteUrl + "/_api/web/title"
$webRequest=New-Object [System.Net.HttpWebRequest]::CreateHttp($svcUrl)
$webRequest.Method="GET"
$webRequest.UseDefaultCredentialsHowever I keep getting this error:
New-Object : Cannot find type [[System.Net.HttpWebRequest]::CreateHttp]: make sure the assembly containing this type is
loaded.
What am I missing?