Hi
Over in http://social.msdn.microsoft.com/Forums/en-US/d64798ca-653a-413c-b262-3a5d8ecee4d2/csom-and-sharepoint-2013 i asked if this should work, the answer is yes, but it does not for me.
I have the 2013 client side SDK installed and the Sharepoint DLLs load OK
>> I am after hints on why this is not working for me ? I am an admin on Sharepoint so of all people, i do have permissions!!
Is it as simple as some setting on the Server to allow CSOM ?
Thanks
Clear-Host
# Tried both variants
#$loadInfo1 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
#$loadInfo2 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
# Shows 15.0.0.0 and GAC info, i.e. load looks correct
$siteUrl = "http://xxxxx.schneider-electric.com" # internal site, not public
$user = "mydomain\user"
$ctx = new-object Microsoft.SharePoint.Client.ClientContext($siteUrl)
$password = "xxxxxxx" | ConvertTo-SecureString -AsPlainText -Force
# Tried with or without credentials, with credentials get an error even though it is the same user#$credentials = $ctx.Credentials = New-Object System.Net.NetworkCredential($user, $password)
#$ctx.Credentials = $credentials
$web = $ctx.Web
$ctx.Load
<# if $ctx.Load($web) is used error
Cannot find an overload for "Load" and the argument count: "1".
At D:\Projects\PowerShell\sharepoint_access.ps1:22 char:10+ $ctx.Load <<<< ($web) # + CategoryInfo : NotSpecified: (:) [], MethodException+ FullyQualifiedErrorId : MethodCountCouldNotFindBest
#>
$ctx.ExecuteQuery()
#
# $ctx.load works in that no error but no objects are valid in $web
Write-Host " Current web title is '$($web.Title)', $($web.Url)"Thanks