0

We are using a software that gives you the capability to extend its functionality via an integrated VBS editor. Inside this system I need to script an interface to our SharePoint online using CSOM to check up some files and folders.

My problem is that I can't find a way to create the necessary COM objects. I was trying the answer posted by Nilpo towards a somewhat similar question Using DLLs in VBScript but it doesn't work.

Dim CTX
Dim CSOMBasePath

CSOMBasePath = "C:\MyPath\Microsoft\SharePoint SDK\Microsoft.SharePointOnline.CSOM.16.1.21116.12000\lib\"

on error resume next
Set CTX = GetObject(CSOMBasePath & "net40-full\Microsoft.SharePoint.Client.dll", "SharePoint.Client.ClientContext")
Set CTX = GetObject(CSOMBasePath & "net40-full\Microsoft.SharePoint.Client.dll", "ClientContext")
Set CTX = GetObject(CSOMBasePath & "net40-full\Microsoft.SharePoint.Client.dll", "Client.ClientContext")
Set CTX = GetObject(CSOMBasePath & "net40-full\Microsoft.SharePoint.Client.dll", "Microsoft.SharePoint.Client.ClientContext")

Set CTX = GetObject(CSOMBasePath & "net45\Microsoft.SharePoint.Client.dll", "SharePoint.Client.ClientContext")
Set CTX = GetObject(CSOMBasePath & "net45\Microsoft.SharePoint.Client.dll", "ClientContext")
Set CTX = GetObject(CSOMBasePath & "net45\Microsoft.SharePoint.Client.dll", "Client.ClientContext")
Set CTX = GetObject(CSOMBasePath & "net45\Microsoft.SharePoint.Client.dll", "Microsoft.SharePoint.Client.ClientContext")

Set CTX = GetObject(CSOMBasePath & "netstandard2.0\Microsoft.SharePoint.Client.dll", "SharePoint.Client.ClientContext")
Set CTX = GetObject(CSOMBasePath & "netstandard2.0\Microsoft.SharePoint.Client.dll", "ClientContext")
Set CTX = GetObject(CSOMBasePath & "netstandard2.0\Microsoft.SharePoint.Client.dll", "Client.ClientContext")
Set CTX = GetObject(CSOMBasePath & "netstandard2.0\Microsoft.SharePoint.Client.dll", "Microsoft.SharePoint.Client.ClientContext")

If CTX Is Nothing Then
    MsgBox "No CTX"
End If
GuidoT
  • 280
  • 1
  • 12
  • I think [this comment](https://stackoverflow.com/questions/9839704/using-dlls-in-vbscript#comment78616625_9846377) on the accepted answer sums it up - *"@BLuM It is if it exposes a COM interface."* Same applies here, it doesn’t work because **the CSOM Dlls don’t expose a COM interface**. – user692942 Jun 30 '21 at 07:27
  • I’ve added the comment into the original answer for clarity instead of just being in the comments. – user692942 Jun 30 '21 at 07:33

0 Answers0