Can I use VBScript or JScript to create SharePoint objects?

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

For example, to update the location of the log file:

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

      

Can this be done?

I know that I will need to run this code using a farm administrator account. I don't have access to PowerShell (yet) and I don't want to compile dozens of small command line utilities to do this.

0


a source to share


3 answers


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



0


a source


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. While I think the "Script" in JScript.NET is a little misleading because it must be compiled before running, it looks like JScript, but has the added benefit of interoperating with all .NET 2.0 compliant libraries.



0


a source


Take a look at SharePoint Web Services. They can be called from VBScript and JScript. More information on SharePoint Web Services here on MSDN.

0


a source







All Articles