Tutorial :Is it possible to use VBScript or JScript to instantiate SharePoint objects?



Question:

I want to be able to run VBScript or JScript on a server using cscript.exe to manipulate SharePoint through the object model.

For example, to update the log file location:

Microsoft.SharePoint.Administration.SPDiagnosticsService serv = new Microsoft.SharePoint.Administration.SPDiagnosticsService();  serv.LogLocation = @"E:\";  serv.Update();  

Is it possible to do this?

I know I would need to run this code using a farm admin account. I don't have access to PowerShell (yet), and I don't want to have to compile dozens of small command line utilities to get this done, either.


Solution:1

OTTOMH, you could probably create COM-callable wrappers for the classes you need, if you have relatively simple needs. My guess is that this will be more trouble than it's worth and that some small console apps would be a better use of your time, if you can't use PowerShell.


Solution:2

I think the best solution in my scenario is not to use plain JScript, but JScript.NET. It is available on any computer with .NET 2.0 installed. Although I think the "Script" in JScript.NET is a bit misleading because it must be compiled before running, it looks like JScript but has the added benefit that it can interact with all .NET 2.0 compatible libraries.


Solution:3

Take a look at the SharePoint Web Services. It is possible to call these from VBScript and JScript. You can find more information about the SharePoint Web Services here at MSDN.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »