Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

CreateHttp not working

$
0
0

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.UseDefaultCredentials

However 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?


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>