En utilisant Sharepoint otite chronique avec PowerShell

Il existe de nombreux exemples en ligne de la façon de l'accès/l'utilisation de SharePoint Côté Client, le Modèle d'Objet avec PowerShell. Mais bien sûr, ils ne semblent pas fonctionner pour moi. Il me semble avoir de la difficulté à accéder à certaines informations d'identification code:

PS C:\Scripts> $webUrl = "https://abc.sharepoint.com>"
PS C:\Scripts> $username = "user3"
PS C:\Scripts> $password = "password"
PS C:\Scripts>
PS C:\Scripts> $ctx = new-object Microsoft.SharePoint.Client.ClientContext($webUrl)
PS C:\Scripts> $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
New-Object : Cannot find type Microsoft.SharePoint.Client.SharePointOnlineCredentials]: make sure the assembly containing this type is loaded.
At line:1 char:30
+ $ctx.Credentials = New-Object <<<<  Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
    + CategoryInfo          : InvalidType: (:) [New-Object], PSArgumentException
    + FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand

Je tente d'accéder à un serveur SharePoint 2010 que nous maintenons qui exige l'authentification d'ouverture de session. Personne ne sait ce que je fais de mal?

OK, donc beaucoup de réponses m'ont dit que je suis en utilisant la mauvaise agrément de type pour cette connexion. J'ai donc changé:

$clientContext = New-Object Microsoft.SharePoint.Client.ClientContext($url)
$clientContext.AuthenticationMode = "FormsAuthentication"
$clientContext.FormsAuthenticationLoginInfo = New-Object Microsoft.SharePoint.Client.FormsAuthenticationLoginInfo("myDomain\myUser", "myPassword")

qui semble bien fonctionner. Mais alors...

$web = $clientContext.Web
$properties = $web.AllProperties
$clientContext.Load($web)

me donne:

> Cannot find an overload for "Load" and the argument count: "1". At
> line:1 char:20
> + $clientContext.Load <<<< ($web)
>     + CategoryInfo          : NotSpecified: (:) [], MethodException
>     + FullyQualifiedErrorId : MethodCountCouldNotFindBest

et quand j'essaie de regarder le $clientContent objet:

PS C:\Scripts> $clientContent | get-member
Get-Member : No object has been specified to the get-member cmdlet.
At line:1 char:28
+ $clientContent | get-member <<<<
    + CategoryInfo          : CloseError: (:) [Get-Member], InvalidOperationException
    + FullyQualifiedErrorId : NoObjectInGetMember,Microsoft.PowerShell.Commands.GetMemberCommand

qui n'a aucun sens. Quelqu'un a une aide pour cela?

Merci à tous. J'ai essayé toutes ces approches, et toujours pas de travail, même si nous faisons de l'utilisation de Formulaires/authentification basée sur les Revendications. C'est ce que je reçois peu importe ce que j'essaie: PS C:\Scripts> $clientContext.Load($web) Ne peut pas trouver une surcharge pour "Charger" et l'argument nombre: "1". Au niveau de ligne:1 caractère:20 + $clientContext.Load <<<< ($web) + CategoryInfo : NotSpecified: (:) [], MethodException + FullyQualifiedErrorId : MethodCountCouldNotFindBest

OriginalL'auteur Michael Frederick | 2013-08-20