0

I was wondering if it is possible to update a Sharepoint List versioning using powershell.

I have attempted to load the SPDocumentLibrary class into powershell by using

[Void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

and attempted to load CSOM by using

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"

I can cast my list object to an SPDocumentLibrary but I am then unable to update that list object

$docLib = ($a3 -as [Microsoft.SharePoint.SPDocumentLibrary])
$ctx.Load($docLib)
Cannot find an overload for "Load" and the argument count: "1".
At line:1 char:1 + $ctx.Load($docLib)
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodCountCouldNotFindBest

I can not even use the Get-Member method to see what methods or parameters I could use for this object.

2

When working with SharePoint remotely, you have to use CSOM and the CSOM model, you can't use any Microsoft.SharePoint.* objects. Everything is Microsoft.SharePoint.Client.*.

Start here to get acquainted with CSOM: http://msdn.microsoft.com/en-us/library/ff798388.aspx

  • Kinda figured as much, I just have over 200 list where I need to update the versioning to only hold 4 major version... – McFrank Aug 13 '14 at 1:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.